views:

55

answers:

2

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 has a value. I need to do this because I will use $('#target').css({'display':'none'}); to a certain div

+2  A: 

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

hunter
A: 

check the link

How to get the querystring with javascript

Azhar
way too complex.
KooiInc