Thursday, February 19, 2009

Get Query String In JavaScript With Split

< script type= "text/javascript" >

function querySt(qsFind)
{
qs = window.location.search.substring(1);

str = qs.split("&"); //Split Query String

for (i=0 ; i < str.length ; i++)
{

cs = str[i].split("="); /Split Individual Query String with =
if (cs[0] == qsFind) //Check for particular query string and if found return value
{
return cs[1];
}
}
}


< / script >

var Ledger_Id = querySt("Ledger_Id");

No comments: