0

我不确定我是否正确地看到了这一点,但是使用 jQuery UI Themeroller 当前的主题设置似乎存储在 URL 中,例如http://www.site.com/page.html#theme-details ...

有没有办法使用javascript从中提取数据?所以我会返回类似的东西

theme-details...

从我刚才提到的网址

还是我弄错了?

4

3 回答 3

1

如果您想要当前文档 URL 的片段标识符:

location.hash

如果你想要一个字符串:

str.match(/^[^#]*#(.*)/)[1]
于 2009-08-31T05:35:14.967 回答
1
window.location.hash

将返回 URL 中 # 符号之后的部分,包括 # 符号。

window.location.hash.substring(1);

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

查看更多

window.location

这里

于 2009-08-31T05:35:18.273 回答
1
document.location.hash.substring(1) // will return "theme-details" minus the hash
于 2009-08-31T05:35:40.350 回答