javascript - 为什么页面跳转链接在 IE 中有效,但在 Mozilla 中无效?

标签 javascript html

Possible Duplicate:
How to insert a page jump and open a tab within the same page

我正在尝试插入一个页面跳转,该页面跳转会在同一页面中打开一个新选项卡。此链接将进入 eBay 模板。该列表应包含一个可打开返回政策的链接(选项卡 3)

我最初使用了下面的代码,该代码在 IE 和 Mozilla 中工作,但只会打开选项卡,而不会跳转到页面。

<a href='#nogo' onclick="show('tab3')">Click Here To View Warranty Details</a>

下面的代码可以运行并打开选项卡 3,并将页面向下滚动到返回政策,但不适用于仅限 mozilla 的 IE。在 mozilla 中,我什至无法单击此链接,但我确实看到了它。

<a href='#infoTabs' onclick="show('tab3')">Click Here To View Warranty Details</a> 

这里是显示返回选项卡 3 和 4(只是为了看看选项卡 3 和 4 是如何流动的)

     <!-- tab 3 --><a name="returns"></a>
        <div id="tab3">
        <ul class="tablinks">
            <li><a href="#nogo" onclick="return show('tab1')">Shipping</a> </li>
            <li><a href="#nogo" onclick="return show('tab2')">Payment</a> </li>
            <li><span>Return Policy</span> </li>
            <li><a href="#nogo" onclick="return show('tab4')">General Info</a> </li>
            <li><a href="#nogo" onclick="return show('tab5')">Intl. Shipping</a> </li>
        </ul>
        <h4 class="tabtitle">Return Policy</h4>
        <ul class="tabinfo"><strong><span style="font-family: verdana, arial, helvetica, sans-serif; color: #293d86;">AudioSavings Return Policy:</span></strong><span style="font-family: verdana, arial, helvetica, sans-serif;"><br />
            <br />
            <strong><span style="color: #293d86;">At Audiosavings, we strongly believe in customer satisfaction and therefore offer a friendly return policy.</span></strong><strong><span style="color: #293d86;"> </span></strong><br />
            <br />
            You may return items to Audiosavings within <strong><span style="color: #293d86;">30 DAYS</span></strong> of purchase. <br />
            <br />
            Warranty Repair Period: <strong><span style="color: #293d86;">1 YEAR</span></strong><br />
            <br />
            <strong><span style="color: #293d86;">Prior to returning merchandise to us you must request a Return Merchandise Authorization Number (RMA#). The RMA# will be valid for 15 days from the date it was issued. </span></strong><strong><span style="color: #293d86;"></span></strong><br />
            <br />
            <strong><span style="color: #293d86;">Defective items</span></strong><br />
            We will replace a defective unit with the same unit within the 30 day period. If for any reason you prefer to exchange your item for a different product, we will issue a store credit for the full price of the item, minus the outgoing shipping costs that were paid to ship the original item to you. Refunds are also available during the initial 30 day period. Refunds are subject to a 10% processing fee and a deduction of the outgoing shipping costs from the total refund amount. If you prefer that we simply replace the item, then there will be no fee charged.<strong><span style="color: #293d86;"></span></strong><br />
            <br />
            <strong><span style="color: #293d86;">Exchanges for different items</span></strong><strong><span style="color: #293d86;"> </span></strong><br />
            If you purchase an item and for any reason want to exchange it for a different product, we are happy to help you do so as long as you contact us within 30 days from the original date of purchase. If the returned item is brand new and still factory sealed, we will issue a store credit for the full price of the item, minus the outgoing shipping costs that were paid to get the original item to you. If the item comes back to us in used or open box condition, there will be in addition to the shipping charges, a 10% processing fee deducted from the issued store credit. (When items are returned that can no longer be sold as brand new, we must then sell them at a significantly cheaper price, therefore we must charge a 10% processing fee for open box return items).<br />
            <br />
            <strong><span style="color: #293d86;">Refunds</span></strong><br />
            Refunds are available within 30 days of the original date of purchase. All refunds will have a 10% processing fee assessed, and the outgoing shipping costs that were paid will also be deducted from the refund total. Please remember, if you choose to exchange the item, and the returned item is still factory sealed, there will be NO processing fee assessed.<strong><span style="color: #293d86;"></span></strong><br />
            <br />
            <strong><span style="color: #293d86;">Replacement/Processing Time</span></strong><br />
            We work hard to process returns as quickly as possible. Your replacement or refund will process within 4 business days of when we receive the item and inspect it at our store. We can only exchange items after we&rsquo;ve received the returned items. <br />
            <strong><span style="color: #293d86;">NOTE:</span></strong> If you need the item sooner, you may choose to do an advanced exchange; wherein you would place a new order for the item, and send back the item you wish to exchange for a full refund with no processing fee, as long as all included pieces and accessories are received with the returned item. <br />
            <br />
            <strong><span style="color: #293d86;">Return shipping</span></strong> <br />
            We will cover all outgoing shipping costs incurred to ship the newly exchanged item to you. The return shipping costs required to ship the item back to our store, are always paid by the customer. <br />
            <br />
            <strong><span style="color: #293d86;">Past 30 days</span></strong><br />
            If the product develops a defect past the first 30 days, we will send you the necessary warranty information to get the item repaired or exchanged (depending on the manufacturer). If any customer has any issue processing a warranty with a manufacturer, we will get involved and do our best to make sure your item gets serviced.<br />
            <br />
            <strong><span style="color: #293d86;">Return Exceptions</span></strong> <br />
            While we always do our best to take back any and all returns, there are a few exceptions of items that cannot be returned to our store due to the fact that the manufacturers will not accept these items back from us. The following are examples of items that cannot be returned:<br />
            <br />
            <ul class="tabinfo">
                <li>Items with physical damage un-related to shipping, i.e., cracked or broken items are not covered under warranty. In the case that you receive an item that has physical damage that occurred during shipping, please notify us within <strong><span style="color: #293d86;">48 hours</span></strong> of when you received the item, and you will be taken care of immediately. </li>
                <li>You <strong><span style="color: #293d86;">MUST notify us within 48 hours</span></strong> if you receive an item that was damaged during shipping. </li>
                <li>Software that has already been registered or installed cannot be returned </li>
                <li>Blown speakers or subwoofers that have burned voice coils or punctured holes are not supposed to be covered under warranty, but we will still <strong><span style="color: #293d86;">do our best</span></strong> to help you get coverage. </li>
            </ul>
            <strong><span style="color: #293d86;">We will always do our best to warranty your product!</span></strong><br />
            <br />
            <strong><span style="color: #293d86;">Process for returning items</span></strong> <br />
            In order to best serve you please follow the instructions below: <br />
            Please <a href="http://contact.ebay.com/ws/eBayISAPI.dll?FindAnswers&amp;redirect=0&amp;requested=audiosavings" target="_blank">email us</a> with <br />
            <ul class="tabinfo">
                <li>Your eBay user ID </li>
                <li>Item code / model # </li>
                <li>Condition of the item (ex: Brand New Sealed, Open Box NEW, Used, Defective) </li>
                <li>The reason for your return </li>
                <li>Please indicate whether you would like an exchange, store credit or a refund. </li>
            </ul>
            We will supply you with a reference number (RMA #) to put on the package which will ensure quick processing of your return. &nbsp;<strong><span style="color: #293d86;">All returns require a RMA# to be returned back to our facility.</span></strong> We will promptly reply back with helpful instructions on how to return the product.</span> <br />
            &nbsp;</ul>
            </div>
            <!-- tab 4 --><a name="info"></a>
            <div id="tab4">
            <ul class="tablinks">
                <li><a href="#nogo" onclick="return show('tab1')">Shipping</a> </li>
                <li><a href="#nogo" onclick="return show('tab2')">Payment</a> </li>
                <li><a href="#nogo" onclick="return show('tab3')">Return Policy</a> </li>
                <li><span>General Info</span> </li>
                <li><a href="#nogo" onclick="return show('tab5')">Intl. Shipping</a> </li>
            </ul>
            <h4 class="tabtitle">General Info</h4>
            <ul class="tabinfo">
                <li><b>Sales Tax:</b> 8.625% in New York only </li>
                <li>Please only click on the buy it now button once if you want one item. </li>
                <li>Our goal is to satisfy all our customers by offering the best possible customer service, and a great selection of great products. </li>
            </ul>
            </div>

<!-- tab 5 --><a name="about"></a>
            <div id="tab5">
            <ul class="tablinks">
                <li><a href="#nogo" onclick="return show('tab1')">Shipping</a> </li>
                <li><a href="#nogo" onclick="return show('tab2')">Payment</a> </li>
                <li><a href="#nogo" onclick="return show('tab3')">Return Policy</a> </li>
                <li><a href="#nogo" onclick="return show('tab4')">General Info</a> </li>
                <li><span>Intl. Shipping</span> </li>
            </ul>
            <h4 class="tabtitle">International Shipping</h4>
            <ul class="tabinfo">
                <li><b>International Buyers - Please Note:</b><br />
                Import duties, taxes and charges are not included in the item price or shipping charges. These charges are the buyer's responsibility. Please check with your country's customs office to determine what these additional costs will be prior to bidding/buying. </li>
                <li><b>For International Customers only:</b> <br />
                Please be advised that for 120 Volt product, you will need a 
                step-down transformer if you live in a country that uses 220 
                Volt outlets. Car products will work without a transformer. </li>
            </ul>
            <p><br />
            </div>
            <script> var shown = document.getElementById('tab1'); function show(id) { if (shown) shown.style.display = 'none'; shown = document.getElementById(id); shown.style.display = 'block'; return false; } </script>
            </div>
            <center><b>Item Code: ##item_cd##</b><br />
            <br />
            <a href="#top">Top</a> </center></div>
            </div>
            <div></div>
            </td>
        </tr>
        <tr>
            <td id="tru_footer">&nbsp;</td>
        </tr>
    </tbody>
</table>

有谁知道如何解决这个问题以及为什么会发生这种情况?

这是链接 http://www.ebay.com/itm/MA-AUDIO-HK-802SX-4400w-RMS-2-CH-CAR-AMPLIFIER-HK802SX-/390483744599?pt=Car_Amplifiers&vxp=mtr&hash=item5aeaa51757

最佳答案

看起来您没有得到您正在寻找的“跳转”的原因是因为您没有具有正确名称的 anchor 。

如果你有这个:

<a href='#infoTabs' onclick="show('tab3')">

那么你必须有一个相应的:

<a id="infoTabs"></a>

我注意到您有一个名为 info 的 anchor ,因此您应该重新命名您的 anchor 或 href,以使它们相同。

但为了确定这就是问题所在,我们需要查看您的 show 函数的内容。

关于javascript - 为什么页面跳转链接在 IE 中有效,但在 Mozilla 中无效?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13917405/

相关文章:

javascript - 通过 Javascript 迭代 XERO API JSON 响应的行和单元格

javascript - IE 的 AJAX document.getElementById().innerHTML 问题?

html - Bootstrap 网格中的图像

javascript - 是否有一个 UI 框架来模拟 Mac 应用程序的外观?

html - 解析 postgresql 查询中的 html 字段

javascript - Three.js 场景实用程序分离/附加角色武器

Javascript (html) - 使变量与 .src 的 img 具有相同的值

javascript - 将 .wav 加载到音频缓冲区中

javascript - 单击 ul 列表中的 "unclicking"元素

Chrome 中的 HTML5 <video> 标签不起作用