admin管理员组

文章数量:1290978

I need to the anchor out of a window.location in JavaScript, such as the following url:

.html#anchor1

What's the easiest method?

I need to the anchor out of a window.location in JavaScript, such as the following url:

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

What's the easiest method?

Share Improve this question asked Mar 29, 2009 at 0:12 Darryl HeinDarryl Hein 145k96 gold badges223 silver badges263 bronze badges 0
Add a ment  | 

2 Answers 2

Reset to default 10

window.location.hash

This should be exactly what you want:

window.location.hash

本文标签: javascriptWhat39s the easiest way to parse the anchor out of the current page39s locationStack Overflow