Wednesday, October 13, 2010

Getting Querystring Parameter Value from Javascript

function querySt(ji) {
 hu = window.location.search.substring(1);
 gy = hu.split("&");
 for (i=0;i<gy.length;i++) {
  ft = gy[i].split("=");
  if (ft[0] == ji) {
   return ft[1];
  }
 }
}
//if you need to get param value from a URL such as 
//this one: http://domain.com?param=value
var koko = querySt("param");
I found this code at this site.

No comments: