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

Peter-Paul Koch gassinaumasis at hotmail.com
Mon May 14 03:03:33 CDT 2001


>I imagine there has to be a way to pull a variable from the
>link/address bar in javascript, right?  so that something like
>"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.

>My reasoning is I'd like to create one page that I can call
>using different variable to, for instance, show various images.
>
>Is this possible?  I know JS enough to make useful functions and
>to know what I'm reading, I just haven't been able to find
>anything like this yet.

Yep, quite possible.

ppk

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.





More information about the thelist mailing list