2012-03-31 66 views

回答

4

window.location.hash返回以 “#” 散,所以你可以使用:window.location.hash.substr(1)

+0

@narendra as Jasd回答它应该可以工作 – Devjosh 2012-03-31 13:01:59

+3

'window.location.hash.replace('#','')'是安全的,因为一些旧的浏览器(IE <= 6我认为)返回散列字符串,没有前导# 。 – 2012-03-31 15:34:09

3

你想window.location.hash在#后只有字符串。

+0

我知道!但是,如何从查询中提取确切的字符串? – 2012-03-31 12:58:56

+0

@NarendraRajput:我看你有答案eveywhere。只需在需要数据的地方执行“window.location.hash”即可。 – 2012-03-31 17:01:39