469,320 Members | 2,140 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,320 developers. It's quick & easy.

Checking if a GET Variable is set - HOW?

Hi guys.

Great site. This site has helped me many times before. But now I have a question to which I am yet to find an answer.

In a nutshell, I need to know how to check if a URL GET variable has been set, and if it has, to set the style of a DIV to display: block;

for instance: www.scott.com/competition.aspx?mode=entry

so.. the GET variable is mode and the value is entry

I would like to know how to check for that variable using javascript, then to have it change the style of my DIV with ID = "entryform" to be visible.

I know this may be a simple one.. but I just can't find anything about checking for GET variables in javascript.

I cannot use ASP, .NET or PHP to do the check.. as I'm working in an HTML template for a CMS.

Any help is greatly appreciated,

thanks in advance,

Mar 26 '08 #1
1 1652
16,027 Expert Mod 8TB
Use the location.search property. Split the string using .split("=") to get the variable/value pair.
Mar 26 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Guy Robinson | last post: by
9 posts views Thread by Bart Nessux | last post: by
3 posts views Thread by Vinodh Kumar P | last post: by
42 posts views Thread by =?Utf-8?B?UGxheWE=?= | last post: by
125 posts views Thread by jacob navia | last post: by
11 posts views Thread by Bryan Crouse | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by Gurmeet2796 | last post: by
reply views Thread by mdpf | last post: by
reply views Thread by listenups61195 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.