<a href="#anchor1">
<img src="http://www.test.com/images/test/test.png" width="80" height="150" />
</a>
<div id="anchor1">...</div>
当我将鼠标悬停在 test.png 上时,我需要它将页面滚动到 #anchor1 ..help_me
最佳答案
在onmouseover
内使用Javascript事件:
<img onmouseover="window.location.hash = 'anchor1'" />
请注意,不要使用“#”字符。
此外,您没有正确命名 anchor 。应该是:
<a name="anchor1"
....而不是 href。
关于javascript - 在 HTML 页面中,我需要在鼠标悬停时锚定到标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4445160/