Click to See Complete Forum and Search --> : using URL query string to get a variable


therealphil
09-12-2003, 05:48 AM
I have a page. It has a variable called test_keyword_woo whos value is a web address.

when i go to my page i add ?test_keyword_woo to the end of the URL.

So far I have gotten my script to grab the query string from the rest of the URL.

Now, I want to use the query string (test_keyword_woo) to get the value of the 'test_keyword_woo' variable and direct the visitor to the URL that the 'test_keyword_woo' variable defines.

HELP! If you understoof that!
Here is my page: http://www.vector-networks.com/test/r/g.htm?test_keyword_woo

dragle
09-12-2003, 08:39 AM
Try this:

window.location.href = window[keyword];

You will probably also want to check keyword first to make sure it matches one of your defined variables, i.e., something like this:

window.location.href =
(window[keyword])?window[keyword]:"default.html";

HTH -

therealphil
09-12-2003, 08:43 AM
Weh hey! It worked!

Thanks very much! :D