从当前页面的位置解析锚点的最简单方法是什么?

时间:2009-03-29 00:12:48

标签: javascript

我需要使用JavaScript中的window.location锚点,例如以下网址:

http://www.example.com/page.html#anchor1

最简单的方法是什么?

2 个答案:

答案 0 :(得分:10)

答案 1 :(得分:5)

这应该是你想要的:

window.location.hash
相关问题