开发者

Javascript window.location.hash is defined?

Is there some开发者_运维百科 way I can tell whether window.location.hash is defined?

If it is set, then I will be getting the value of the variable, and using it to display extra content on the page.


if(window.location.hash) {
    // do stuff!
}


How about:

if(window.location.hash !== '')
{
}

Or

if(typeof window.location.hash !== 'undefined')
{
    //your code
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜