2012-03-31 65 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