JS Code:
<script language= "JavaScript" >functiongetrequest () {varURL =Location.search; varTherequest =NewObject (); if(Url.indexof ("?")! =-1) { varstr = URL.SUBSTR (1); STRs= Str.split ("&"); for(vari = 0; i < strs.length; i + +) {Therequest[strs[i].split ("=") [0]]=unescape (Strs[i].split ("=") [1]); } } returntherequest; }
Regular:
function getrequest (name) { varnew RegExp ("(^|&) + name +" = ([^&]*) (&|$) "); var r = window.location.search.substr (1). Match (reg); if (r!=null) return return NULL ; }
If there are characters above the method of the return results will be garbled, you can use decodeURI and encodeURI to solve
Window.href = http://www....?name= ' +encodeuri (store_name)
function getrequest (name) { varnew RegExp ("(^|&)" + name + "= ([^&]*) (&|$)"); var r = window.location.search.substr (1). Match (reg); if (r!=null) return decodeURI (r[2]) return NULL ;}
JS get URL to send parameter