开发者

Using javascript to check if a querystring has a value

New in JS, How do I check if one of my querystring has a value?

Example: I have result.aspx?loc=3. How do I check this in javascript if my querystring loc开发者_JAVA百科 has a value. I need to do this because I will use $('#target').css({'display':'none'}); to a certain div


try location.search

The search property returns the query portion of a URL, including the question mark (?).

and can be called like so:

<script type="text/javascript">
    document.write(location.search);
</script>

http://www.w3schools.com/jsref/prop_loc_search.asp

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜