我可以在浏览器地址栏上获取#值吗

Can i get the #value on the browser address bar?

本文关键字:获取 值吗 地址栏 浏览器 我可以      更新时间:2024-04-16

可能重复:
查找“”使用Javascript的字符串中的字符
如何使用jquery 从URL获取散列(#)后的值

我可以在浏览器地址栏上获取#值吗
例如URL中的示例:http://test.com/#div1
我可以使用javascript从该url获取div1吗?

您可以使用window.location.hash