我有以下超链接:
<a name="top"></a>
我的按钮如下所示:
<span id="listControl_1_ctl15" onclick="window.location='#top'" class="TextButton">
<span class="button_left"></span>
<span class="button_text">Bovenaan</span>
<span class="button_right"></span>
</span>
我的页面未导航到顶部。有谁知道为什么?
答案 0 :(得分:4)
把它放在你称之为顶部的地方:
<a name="top"></a>
然后您可以使用它来转到链接
<a href= "#top"> go to the top </a>
如果你想要转到整个页面的顶部,你也可以使用它:
<a href = #> TOP! </a>
的Stefan。
答案 1 :(得分:3)
使用window.location.hash
:
<span id="listControl_1_ctl15" onclick="window.location.hash='top'" class="TextButton">
<span class="button_left"></span>
<span class="button_text">Bovenaan</span>
<span class="button_right"></span>
</span>
答案 2 :(得分:2)
你应该使用hash:
window.location.hash='top'