2009-08-31 40 views

回答

1

如果你想在当前文档的URL的片段标识符:

location.hash 

如果你想有一个字符串的它:

str.match(/^[^#]*#(.*)/)[1] 
1
window.location.hash 

将返回URL的一部分#符号后面,包括#符号。

window.location.hash.substring(1); 

将返回主题的详细信息...

查看更多关于

window.location 

here

1
document.location.hash.substring(1) // will return "theme-details" minus the hash