JS获得URL超链接的参数值
2013-06-21 15:56:23 来源:WEB开发网核心提示:var url = location.href; //获取keyword的参数值var es=/keyword=/;es.exec(url);var result=RegExp.rightContext;例如:var url = location.href; //获取pid的参数值var es=/pid=/;es.ex
var url = location.href; //获取keyword的参数值 var es=/keyword=/; es.exec(url); var result=RegExp.rightContext;
例如:
var url = location.href; //获取pid的参数值 var es=/pid=/; es.exec(url); var pid=RegExp.rightContext; var aurl = "&pid="+pid;
alert(pid);//结果:&pid=37
更多精彩
赞助商链接