好贷网好贷款

js获取当前Url网址路径及参数(转)

发布时间:2016-12-3 21:42:39 编辑:www.fx114.net 分享查询网我要评论
本篇文章主要介绍了"js获取当前Url网址路径及参数(转)",主要涉及到js获取当前Url网址路径及参数(转)方面的内容,对于js获取当前Url网址路径及参数(转)感兴趣的同学可以参考一下。

http://localhost:81/Test/1.htm?Did=123<br>以下为输出:<br><SCRIPT> //获取Url传过来的值function Request(name){     new RegExp("(^|&)"+name+"=([^&]*)").exec(window.location.search.substr(1));     return RegExp.$2} thisURL = document.URL;     // http://localhost:81/Test/1.htm?Did=123thisHREF = document.location.href; // http://localhost:81/Test/1.htm?Did=123thisSLoc = self.location.href;   // http://localhost:81/Test/1.htm?Did=123thisDLoc = document.location;   // http://localhost:81/Test/1.htm?Did=123 thisTLoc = top.location.href;   // http://localhost:81/Test/1.htm?Did=123thisPLoc = parent.document.location;// http://localhost:81/Test/1.htm?Did=123thisTHost = top.location.hostname; // localhostthisHost = location.hostname;   // localhost thisU1 = window.location.protocol; // http:thisU2 = window.location.host;   // localhost:81thisU3 = window.location.pathname; // /Test/1.htm document.writeln( thisURL + "<br />"); document.writeln( thisHREF + "<br />"); document.writeln( thisSLoc + "<br />"); document.writeln( thisDLoc + "<br />"); document.writeln( thisTLoc + "<br />"); document.writeln( thisPLoc + "<br />"); document.writeln( thisTHost + "<br />"); document.writeln( thisHost + "<br />"); document.writeln( thisU1 + "<br />"); document.writeln( thisU2 + "<br />"); document.writeln( thisU3 + "<br />"); document.writeln( "Did="+Request("Did") );// Did=123 </SCRIPT>

上一篇:CoCreateInstanceEx详解
下一篇:SQL查询效率:100w数据查询只需要1秒钟

相关文章

相关评论