[thelist] passing a JS variable to another page? Can I?

Filip Salomonsson filip at netdesign.se
Mon May 14 06:01:08 CDT 2001


> >"A href='webpage.html?santa'" would be the link, and
> >webpage.html could declare a variable that pulls in that item?

> In webpage.html:
>
> var page = location.href;
> var x = page.substring(page.indexOf('?')+1);
>
> Now the string 'santa' is in variable x and you can do whatever you like
> with it.

Or just use document.search. Unfortunately, it includes the '?', so you'll
still be stuck with using .substring().

	var myVal = location.search.substring(1);

/filip






More information about the thelist mailing list