0
這裏的簡單邏輯,我不知道我怎樣才能將這個值與由window.location.hash
返回的散列分開。像.split('=')[0]
,但刪除它之前的一切,而不是它後面的一切。jQuery如果散列有一個附加值
一些潛在的哈希值:/#work
/#work=video1
我想說:
var hash = window.location.hash,
val = hash.split('=')[0];
if (val != ''){
do some stuff because there IS a value
i.e. once split, the value is something
} else {
do some other stuff because there IS a value
i.e. once split, the value is nothing
}
這僅獲得第一位的,怎麼樣,如果他們有多個值嗎? –