2013-01-11 49 views
-3

我需要JavaScript的标签,这不需要<head>版(它不会是posible)。用于制作标签的JavaScript不需要<head>版本?

我有三个链接和三个div,我需要这样的东西,链接推会显示一个div,其他隐藏,其他链接推,显示其他div和所有其他隐藏然后。

这里是我的代码:

<div style="text-align: left;"> 
      <ul style="margin: 0 0 0 0;"> 
       <li style="display:inline; margin-left: 3px; text-align: center; width:90px; background-color:#58794c; border-top:1px dotted #015811; border-left:1px dotted #015811; border-right:1px dotted #015811;"><a style="color: #ffffff; font-size: 28px; text-decoration: none;" href="#">Postage</a></li> 
       <li style="display:inline; margin-left: 3px; text-align: center; width:90px; background-color:#558b40; border-top:1px dotted #015811; border-left:1px dotted #015811; border-right:1px dotted #015811;"><a style="color: #efda5d; font-size: 28px; text-decoration: none;" href="#">Return</a></li> 
       <li style="display:inline; margin-left: 3px; text-align: center; width:90px; background-color:#66ac4a; border-top:1px dotted #015811; border-left:1px dotted #015811; border-right:1px dotted #015811;"><a style="color: #efda5d; font-size: 28px; text-decoration: none;" href="#">Payment</a></li> 
      </ul> 
     </div> 
     <div style="width:324px; background-color:#58794c; color: #efda5d; border-bottom:1px dotted #015811; border-left:1px dotted #015811; border-right:1px dotted #015811;" title="Shipping information"><p style="text-align: left; margin-left: 10; margin-top:0;">Available shipping type/It's price/Additional cost for this product:<br />[[ShippingService1]]/[[ShippingServiceCost1]]/[[ShippingServiceAdditionalCost1]]<br />[[ShippingService2]]/[[ShippingServiceCost2]]/[[ShippingServiceAdditionalCost2]]<br />[[ShippingService3]]/[[ShippingServiceCost3]]/[[ShippingServiceAdditionalCost3]]<br />More information about products delivery you will find by clicking <a style="color: #ffffff;" href="http://stores.ebay.co.uk/Digi-Spot/Delivery.html">here</a>.</p></div> 
     <div style="width:324px; background-color:#558b40; color: #efda5d; border-bottom:1px dotted #015811; border-left:1px dotted #015811; border-right:1px dotted #015811;" title="Return information"><p style="text-align: left; margin-left: 10; margin-top:0;">Product must be returned within [[ReturnWithin]] to this adress <b>[[ReturnAddress]]</b>. For return shipping pays <b>[[ReturnShipPaid]]</b>.<br /> More information about returning products you will find by clicking <a style="color: #ffffff;" href="http://stores.ebay.co.uk/Digi-Spot/Returns.html">here</a>.</p></div> 
     <div style="width:324px; background-color:#66ac4a; color: #efda5d; border-bottom:1px dotted #015811; border-left:1px dotted #015811; border-right:1px dotted #015811;" title="Payment information"><p style="text-align: left; margin-left: 10; margin-top:0;">Product price is <b>[[FixedPrice]]</b><br />Additional payment instructions for this product: [[PaymentInstructions]]</p></div> 

而这就是我想要的一个例子:http://www.isdntek.com/tagbot/tabtop.htm

也许我需要添加的div名称或ID,并有显示或隐藏的简单函数divs(这将执行链接点击),但我找不到一个不需要编辑<head>

+1

欢迎来到Stack Overflow。请注意,发布系统接受某些HTML标签,因此当您需要显示文字标签时,您必须使用工具栏按钮将其标记为代码。这次我为你做了。 –

+2

“我需要JavaScript的标签,不需要''版(它不会是posible)。” - 这是任何标签库(即使情况并非如此,如果您无法修改头部,则需要修复CMS或修复不允许修改的业务文化) – Quentin

+0

eBay不允许在列表模板中进行修改。无论如何感谢您的建议 – Tautvydas

回答

0

正如Quentin所说,在对您的问题发表评论时,几乎任何提供标签小部件(或任何其他解决方案来构建标签)的JavaScript库都不需要在页面的<head>部分执行任何操作。嗯......其实这样做,因为你把调用到外部JavaScript文件有:

<script type="text/javascript" src="libs.js"></script> 

但是,这只是一个让你的代码干净的形式。如果你不太喜欢头部,你可以在你的<body></body>部分几乎任何地方放置同一条线,它也应该可以工作。

因此,如果可能每个提供制表符的JavaScript库都可以在没有修改<head>的情况下工作,那么让我们使用世界上最多(或几乎最多)着名的 - jQuery UI

正如你可以在给定的例子中看到的(点击“查看源代码”),所有你需要做的,得到的标签,就是把你的<body></body>是这样的:

<div id="tabs"> 
    <ul> 
     <li><a href="#tabs-1">Tab 1 Title</a></li> 
     <li><a href="#tabs-2">Tab 2 Title</a></li> 
     <li><a href="#tabs-3">Tab 3 Title</a></li> 
    </ul> 
    <div id="tabs-1"> 
     <p>Tab 1 Text</p> 
    </div> 
    <div id="tabs-2"> 
     <p>Tab 2 Text</p> 
    </div> 
    <div id="tabs-3"> 
     <p>Tab 3 Text</p> 
    </div> 
</div> 

然后再次,jQuery UI的作者会告诉你,你应该把调用的jQuery的jQuery UI的库最新版本到您的<head></head>部分:

<script src="http://code.jquery.com/jquery-1.8.3.js"></script> 
<script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script> 

但是,正如我写信给你,你也可以把这个在任何地方,例如,只是用来<div>之前声明的标签:

<script src="http://code.jquery.com/jquery-1.8.3.js"></script> 
<script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script> 
<div id="tabs"> 
    <ul> 
    ... 

这将是所有的,乡亲们! :]

相关问题