Use the  JavaScript object "Location"

Example:
URL: http://www.www.com/index.htm?foo=bar
location.search;       returns ?foo=bar

Then use the JavaScript object "String" to search the string and exact the
value.
Use the method:  indexOf( ) to search the string for the character "="
Then use the method: substr( ) to get the "bar" out of the string.

Mark.
_________________________________________
Mark McCulligh, Application Developer / Analyst
Sykes Canada Corporation www.SykesCanada.com
(888)225-6824 ex. 3262
[EMAIL PROTECTED]
----- Original Message -----
From: "Raphael Hamzagic" <[EMAIL PROTECTED]>
Newsgroups: php.general
To: <[EMAIL PROTECTED]>
Sent: Friday, September 06, 2002 3:06 PM
Subject: setting javascript variables on url


> Anyone knows if there's a way to set a javascript variable in the calling
> url. Like:
>
> http://www.www.com/index.htm?foo=bar
>
> in index.htm:
> <script language="javascript">
> <!--
> alert(foo)
> //-->
> </script>
>
> Should print "bar"
>
> Thanks
>
> Raphael
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to