简体   繁体   中英

What's the easiest way to parse the anchor out of the current page's location?

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

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

What's the easiest method?

这应该是你想要的:

window.location.hash

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM