我有一个带有 style="overflow: auto" 的 div,里面有一些文字。该文本有一些锚点,我在 div 左侧有链接(不在 div 内),每次单击转到锚点时,页面都会移到底部,就像锚点在页面底部一样。
有什么办法可以防止这种情况发生吗?
<a href='#id2'>Link</a>
<div style='width: 100px; overflow: auto;'>
Text Inside, Big text with <hr id='#id10' /> here
Text Inside, Big text with <hr id='#id5' /> here
Text Inside, Big text with <hr id='#id6' /> here
Text Inside, Big text with <hr id='#id27' /> here
Text Inside, Big text with <hr id='#id24' /> here
Text Inside, Big text with <hr id='#id20' /> here
Text Inside, Big text with <hr id='#id21' /> here
Text Inside, Big text with <hr id='#id23' /> here
Text Inside, Big text with <hr id='#id22' /> here
Text Inside, Big text with <hr id='#id2' /> here
<div>
编辑:我既不使用 Javascript 也不使用 Iframe
编辑:在 Firefox 3 中测试