-
2
- #1
In case anyone missed it, you can emulate Request.QueryString functionality (client-side) with this object that I've created:
jared@eae.net -
Code:
//only properly handles querystrings in the following format:
// [URL unfurl="true"]http://thepage.htm?mykey1=value1&mykey2=value2[/URL]
function QSHandler()
{
var i,j,tmparray,strata,prlen
strata = window.location.search
strata = strata.substring(1,strata.length)
if(strata.indexOf('&')>=0)
{
prsarray = strata.split('&')
prlen = prsarray.length
tmparray = new Array()
for(t=j=0;j<prlen;j++)
{
tmparray[t++] = prsarray[j].split('=')[0]
tmparray[t++] = prsarray[j].split('=')[1]
}
}
else
{
tmparray = new Array(strata.split('=')[0],strata.split('=')[1])
}
tlen = tmparray.length
this.data = new Array()
for(i=0;i<tlen;i++)
{
this.data[new String(tmparray[i])]=tmparray[++i]
}
this.QueryString=function(x)
{
return this.data[x]
}
}
Request = new QSHandler()