Sep 19, 2009

How to get the Query string value through javascript

Requirement is to get the querystring value through javascript.


Here Querystring variable name is “Tag”


Add this function in the javascript block of the page and call according to the requirement.I am calling this function on page load.


Here is code:


-----------------------------



function querySt() {

var url = window.location.search.substring(1);

var qSColl = url.split("&");

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

qsValue = qSColl[i].split("=");

if (qsValue[0] == 'Tag') {

var tabValue = qsValue[1];

}

}

}

---------------------------------

So this way you can access any variable value from the querystring

So your job is done

Enjoy!!!

No comments:

Post a Comment