No PHP? No Problem*
Posted: Wed Jul 23, 2003 1:29 pm
I don't know if this will be handy for anyone.. it's a little function I coded that allows you to send variables from page to page without any server-side code (like PHP) and without having to submit a form.
To use it simple copy and paste the following script into the <head> of your html page.
You can then send variables from page to page using the default my_page.html?username=bob&age=18 type method... then the variables will be available to JavaScript and can be used however you want.
To use it simple copy and paste the following script into the <head> of your html page.
You can then send variables from page to page using the default my_page.html?username=bob&age=18 type method... then the variables will be available to JavaScript and can be used however you want.
Code: Select all
<script language="JavaScript">
var url_u = window.location.href;
if(url_u.indexOf('?')!=-1?true:false)
{
var url_v = url_u.split('?')ї1];
if(url_v.indexOf('&')!=-1?true:false)
{
var url_l = url_v.split('&');
for(var i=0; i<url_l.length; i++)
{
eval("var "+url_lїi].split('=')ї0]+" = url_lїi].split('=')ї1]");
}
}
else
{
eval("var "+url_v.split('=')ї0]+" = url_v.split('=')ї1]");
}
}
</script>