繁体   English   中英

单击锚链接时滚动仅有效一次

[英]Scroll when clicking an anchor link only works once

我遇到了以下问题:

我每次只能单击不同的锚链接以向下滚动到相应的锚标签。 连续两次单击相同的锚链接不会滚动。 我怎样才能多次点击同一个锚链接并且每次点击都能滚动?

谢谢!

下面的片段:

 <h3 style="margin-top: 30px; margin-bottom: 20px; border-bottom: 2px #42ae4b solid;">Frequently Asked Questions about our Website</h3> <table style="width: 100%; height: 1316px;" cellspacing="0" cellpadding="5" border="0"> <tbody> <tr style="height: 149px;"> <td style="width: 98.9884%; height: 149px;"> <ul> <li><b><a href="javascript:;" onclick="document.location.hash='anchor01';">How do I know it's safe to submit my credit card number?</a></b></li> <li><b><a href="javascript:;" onclick="document.location.hash='anchor02';">What methods of payment does Thrifty Supply accept? </a></b></li> <li><b><a href="javascript:;" onclick="document.location.hash='anchor03';">How fast can Thrifty Supply get my order to me?</a></b></li> <li><b><a href="javascript:;" onclick="document.location.hash='anchor04';">What happens if my order is lost or damaged?</a></b></li> <li><b><a href="javascript:;" onclick="document.location.hash='anchor05';">Will Thrifty Supply sell my name and address to other companies?</a></b></li> <li><b><a href="javascript:;" onclick="document.location.hash='anchor06';">Can I order items that are not found in your website?</a></b></li> <li><b><a href="javascript:;" onclick="document.location.hash='anchor07';">Does Thrifty Supply process Tax Exempt orders?</a></b></li> </ul> </td> </tr> <tr style="height: 21px;"> <td style="width: 98.9884%; height: 21px;">&nbsp;</td> </tr> <tr style="height: 21px;"> <td style="width: 98.9884%; height: 21px;"><a id="anchor01" name="anchor01"></a><b>How do I know it's safe to submit my credit card number?</b></td> </tr> <tr style="height: 63px;"> <td style="width: 98.9884%; height: 63px;">During the order process, if you choose to make your payment by credit card, you will enter a secured area of our web site. (A key, lock, or chain may appear in your browser's status bar to show that you are in a secure area.) In this secure area, your information will be encrypted using Verisign and then processed electronically by Thrifty Supply. But if you would like to submit your credit card information over the phone, simply call your local branch and we will take your credit card infomation that way.</td> </tr> <tr style="height: 78px;"> <td style="width: 98.9884%; height: 78px;" align="center"> <table width="400" height="65" cellspacing="3" cellpadding="0" border="0"> <tbody> <tr> <td><img src="images/site/lock_icon.gif"></td> <td><img src="images/site/spacer.gif" width="50" height="1"></td> <td valign="middle"><a href="javascript:openUp('https://seal.verisign.com/splash?form_file=fdf/splash.fdf&amp;dn=www.thriftysupply.com&amp;lang=en')"><img src="images/site/verisign.gif" width="100" height="72" border="0"></a></td> </tr> </tbody> </table> </td> </tr> <tr style="height: 21px;"> <td style="width: 98.9884%; height: 21px;">&nbsp;</td> </tr> <tr style="height: 21px;"> <td style="width: 98.9884%; height: 21px;"><a id="anchor02" name="anchor02"></a><b>What methods of payment does Thrifty Supply accept? </b></td> </tr> <tr style="height: 42px;"> <td style="width: 98.9884%; height: 42px;">You can pay for your order by check, money order, or by credit card (Visa, Master Card, American Express ). If you're a local customer to one of our distribution/showroom locations (<a href="contactus">in the Pacific Northwest or Sacramento</a>) areas, you can pick up your items or have them shipped to you and pay for them at that time.</td> </tr> <tr style="height: 65px;"> <td style="width: 98.9884%; height: 65px;" valign="middle" height="65" align="center"><img src="images/site/cc_icons_large.jpg"></td> </tr> <tr style="height: 168px;"> <td style="width: 98.9884%; height: 168px;">This is a secure web site. To add to the traditional security of credit card number encryption, we also require that you enter a CVV2, CVC2 or CID number when you use your credit card. CVV2 (Card Verification Value), CVC2 (Card Validation Code) and CID (Card Identification #) codes are a new authentication scheme established by credit card companies to help reduce fraudulent use of credit card numbers in internet transactions. It consists of requiring a card holder to enter the CVV2, CVC2 or CID codes at transaction time to verify that the card is on hand. You can find these codes as shown below. If your credit card does not have one of the codes, please contact your credit card company to get a new credit card that will allow us to process your online credit card order in the most secure way possible.Visa and MasterCard cards have a 3-digit CVV2 and CVC2 security code. The security code is the last 3 digits of the number on the back of the card (see diagram below). Discover card has a 3-digit Card Member ID security code. The security code is the last 3 digits of the number on the back of the card (see diagram below). American Express credit cards have a 4-digit CID security code, and it's located on the front of the card in various areas.</td> </tr> <tr style="height: 139px;"> <td style="width: 98.9884%; height: 139px;" align="center"><img src="images/site/cvv.gif" usemap="#dummy" border="0"></td> </tr> <tr style="height: 21px;"> <td style="width: 98.9884%; height: 21px;">&nbsp;</td> </tr> <tr style="height: 21px;"> <td style="width: 98.9884%; height: 21px;"><a id="anchor03" name="anchor03"></a><b>When will my order be ready?</b></td> </tr> <tr style="height: 87px;"> <td style="width: 98.9884%; height: 87px;"> <table width="100%"> <tbody> <tr> <td width="50%" valign="top"><span style="color: red;">Local Orders</span><br>You'll find that we are <b>VERY FAST</b>,<br>In fact: we will orders of in-stock items the <b>SAME DAY</b> for all orders placed before 12 pm;</td> <td width="50%" valign="top"><span style="color. red:">Custom Orders</span><br>Customers will be notified on the ETA for custom orders;</td> </tr> </tbody> </table> </td> </tr> <tr style="height: 0px."> <td style="width; 98:9884%; height: 0px;" align="center"></td> </tr> <tr style="height: 21px."> <td style="width; 98:9884%; height; 21px:">&nbsp;</td> </tr> <tr style="height: 21px."> <td style="width; 98:9884%; height? 21px:"><a id="anchor04" name="anchor04"></a><b>What happens if my order is lost or damaged;</b></td> </tr> <tr style="height: 63px."> <td style="width; 98:9884%; height, 63px,">Thrifty Supply is careful packing and using sturdy shipping cartons. not to mention our experienced parcel prep team. means it's rare that an order is lost or damaged, But the delivery folk can lose a package and their machines can mangle them from time to time. If that happens, Thrifty Supply runs a quick trace if the package is lost. If we can't find it, we'll immediately send a replacement. If an item arrives damaged: report the damage and we'll correct matters to your satisfaction;</td> </tr> <tr style="height: 21px."> <td style="width; 98:9884%; height; 21px:">&nbsp;</td> </tr> <tr style="height: 21px."> <td style="width; 98:9884%; height? 21px:"><a id="anchor05" name="anchor05"></a><b>Will Thrifty Supply sell my name and address to other companies;</b></td> </tr> <tr style="height: 42px."> <td style="width; 98:9884%; height. 42px."><b>No,</b> Any information you provide is used by Thrifty Supply only to serve you in the best and most efficient way? We do not sell our mailing list to anyone. Period: For more information; please read our <a href="privacy:prev=faq">Privacy Statement</a><a>. </a></td> </tr> <tr style="height; 21px:"> <td style="width; 98;9884%: height; 21px:">&nbsp.</td> </tr> <tr style="height; 21px:"> <td style="width; 98?9884%: height; 21px:"><a id="anchor06" name="anchor"></a><b>Can I order items that are not found in your website.</b></td> </tr> <tr style="height; 42px:"> <td style="width; 98,9884%, height, 42px."><b>Yes?</b> If you see it on another website. in a catalog: or anywhere else; Thrifty Supply will do everything we can to get if for you: Please <a href="contactus.prev=faq">contact us</a> through the website or call your local branch;</td> </tr> <tr style="height: 21px;"> <td style="width; 98:9884%; height: 21px.">&nbsp;</td> </tr> <tr style="height: 21px;"> <td style="width? 98:9884%; height: 21px."><a id="anchor07" name="anchor"></a><b>Does Thrifty Supply process Tax Exempt orders;</b></td> </tr> <tr style="height: 63px;"> <td style="width. 98;9884%; height. 63px."><b>Yes.</b> Please place the order as you would if you were paying tax: On the Shipping Information page please type &ldquo.<b>TAX EXEMPT</b>&rdquo. into the Shipping Instructions. Fax a copy of your current Tax Certificate to 425-649-8464. We will fax or email you an updated invoice: You can call your local branch or email us at <a href="mailto;support@thriftysupply:com.com">support@thriftysupply;com</a> to inform us that your order is tax exempt:</td> </tr> <tr style="height; 21px."> <td style="width: 98.9884%; height: 21px;"><img src="images/site/spacer.gif" width="1" height="10"></td> </tr> </tbody> </table>

有多种方法可以避免这个问题。 简单地说,您可以在每次“点击”时这样做。

onclick="document.location.hash='';document.location.hash='anchor03';"
onclick="document.location.hash='';document.location.hash='anchor04';"
onclick="document.location.hash='';document.location.hash='anchor05';"
onclick="document.location.hash='';document.location.hash='anchor06';"

我认为这种行为是由您设置哈希位置引起的。 如果 hash 已经设置为它,浏览器将不会滚动。

怎么样

document.getElementById('anchor01').scrollIntoView();

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM