Friday, October 24, 2008

How To Get Query-String Values From Javascript ?



function GetQueryStringValueFor(key)
{
var valueToReturn="";
var query = window.location.search.substring(1);
var parms = query.split('&');
for(var i=0 to parms.length)
{ var pos = parms[i].indexOf('=');
if (pos > 0)
{
if(key==parms[i].substring(0,pos))
{
valueToReturn = parms[i].substring(pos+1);
}
}
}
return valueToReturn;
}

1 comment:

Anonymous said...

The blog is helpfull...
visit also asp.net [c#]