How to get value from QueryString.
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
function querySt(elementName) {
curulr = window.location.search.substring(1);
qryElement = curulr.split("&");
for (i=0;i< qryElement.length;i++) {
spltdElement = qryElement [i].split("=");
if (spltdElement[0] == elementName) {
return spltdElement[1];
}
}
}
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
This is very small function but very power full. You need to pass query string element name and if it is in query string it will return the value what it is holding.
Here is an example…
I want to get value of ID from query string using this function.
var _newID= querySt(“ID”);
alert(_newID);
now I will get one alert with value of id…..
No comments:
Post a Comment