View Single Post
  #4 (permalink)  
Old 06-14-06, 03:01 AM
TwoD TwoD is offline
Community VIP
 
Join Date: Sep 2003
Location: 404
Posts: 1,813
Thanks: 0
Thanked 0 Times in 0 Posts
Note that defining (and setting the values of) the variables outside the function like that will probably return an error because the page won't have finished loading when the script is executed. Either that or the "theQuery.." variables will all be empty since document.getElementById("") won't return a list of elements if it can't find them.

You would only need to do
Code:
var theQuery,theQuery_a,theQuery_b;
outside the function to make those variables global. Keep the rest of the code in the function but remove the var before the "theQuery.." variables or they will still be declared as private to that function.

That way, you can change any part of the query string any time by simply doing
Code:
theQuary="something new"
and the complete url string will be recreated inside the function each time it runs.
__________________
[W3Schools - learn all about the standards.] [QuirksMode - Browser Quirks] [MS's Online Reference Docs] [DOM in Gecko.]
Please pay attention to stickys, announcements and forum rules, thank you.
Please also remember Code Wrappers and [SOLVED] Marking, this helps everyone.
Reply With Quote