[Javascript] Reading a variable from the URL
Paul Novitski
paul at juniperwebcraft.com
Tue Jul 17 09:27:50 CDT 2007
At 7/17/2007 06:25 AM, Terry Riegel wrote:
>I am working on a simple slideshow. The page will be static with
>javascript added for interactivity. I would like to read the URL do
>determine what image is the current image. For example the static page is.
...
>/sites/thebrowns/photos/200707/id200707030607.html?image=5
>
>Since it is static I would like my javascript to parse the URL and
>set image to 5.
Like others, I use the string method split() to accomplish
this. First split on '?' to isolate the querystring (if any) in
array[1], then split on '&' to separate the arg-value pairs (if any),
then split each of those on '=' to separate each parameter and its value.
Regards,
Paul
__________________________
Paul Novitski
Juniper Webcraft Ltd.
http://juniperwebcraft.com
More information about the Javascript
mailing list