js获取get参数

<script language="JavaScript">
function Request(argname)
{
alert (hiddenid);
var url = document.location.href;
var arrStr = url.substring(url.indexOf("?")+1).split("&");
//return arrStr;
for(var i =0;i<arrStr.length;i++)
{
   var loc = arrStr[i].indexOf(argname+"=");

   if(loc!=-1)
   {
    return arrStr[i].replace(argname+"=","").replace("?","");
    break;
   }
  
}
return "";
}

alert (Request('id'));
</script>

Leave a Reply

(will not be published)