[thelist] JavaScript and GET name value pairs

.jeff jeff at members.evolt.org
Wed Dec 18 21:31:00 CST 2002


> From: Tom Dell'Aringa
> > http://members.evolt.org/jeff/code/js_url_variables/index.cfm
> Thanks for the code Jeff, as usual concise and works
> perfectly. Quick question - how does the object
> reference url.name resolve when the code snippet never
> actually 'runs' - its not a function that gets called
> via an event. Does the stating of the object reference
> create the object and run the code?

yes, it's really that simple.  location.search is available from the second
the page starts loading so there's no point in waiting for the onload event
to generate the url object.  i wanted this code block to be completely
stand-alone so that i could use it in any project and know that any query
string name/value pairs had already been recreated in url variables ala
coldfusion.  i didn't want to have to call functions to get back a name's
value.  i wanted it to be as absolutely simple as possible.  this is one of
those times where simpler really is better.


jeff at members.evolt.org

More information about the thelist mailing list