[thelist] re: js url variables

Tom Dell'Aringa pixelmech at yahoo.com
Thu Mar 13 08:59:01 CST 2003


--- michael grover <mike at michaelgrover.com> wrote:

> I want to use Javascript to grab one particular variable out of a
> url sting containing many variables and I want to populate that
> variable into the text box of a form on the page.
> 
> I have no control over the position of the variable nor of how many
> variables there are in the string.

This seems to get asked a lot. Anyway, courtesy of .jeff:

<http://evolt.jeffhowden.com/jeff/code/js_url_variables/index.cfm?foo=bar&far=boo&cfid=1235908&cftoken=14598715>


Watch the wrap. Read his explanation. This will allow you to grab any
name/value pair in the URL by simply doing:

url.foo or url["foo"] and get teh value. Then you can populate say a
text box like:

<input type="text" value="
<script>
url["foo"]
</script>
" />

HTH

Tom


=====
>^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
http://www.pixelmech.com/
var me = tom.pixelmech.webDeveloper();

http://www.maccaws.com/
[Making A Commercial Case for Adopting Web Standards]

__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - establish your business online
http://webhosting.yahoo.com


More information about the thelist mailing list