用JS获得地址栏上的参数值

String.prototype.getQueryString = function(name)    
{    
  var reg = new RegExp("(^|&|\\?)"+ name +"=([^&]*)(&|$)"), r;    
  if ( r=this.match(reg) ) return unescape(r[2]);    
  return null;    
}    
       var httpUrl = document.URI;    
       var userName_f1 =  httpUrl.getQueryString("user");   

你可能感兴趣的:(prototype)