js获取页面上的参数的方法。
本文主要介绍了参数的页面通过window.location.search,这是测试OK功能getquerystring(name){
VaR reg = new RegExp((^ |)+姓名+=({ ^ } *)(|美元)
VAR r = window.location.search.substr(1)匹配(REG);
如果(r)!= null)返回(r { 2 });返回null;
}
VaR SNAME = getquerystring(名称);
如果(SNAME!= null)
{
无功sname_ = decodeuricomponent(SNAME);
警报(sname_);
}
测试
Abcd.htmlname=xyz
XYZ应该被弹出。