js获取当前Url网址路径及参数 location.hostname
来源:互联网 发布:积分兑换软件 编辑:程序博客网 时间:2024/05/18 00:08
输入的网址是(没有框架):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=123
thisHREF = document.location.href; // http://localhost:81/Test/1.htm?Did=123
thisSLoc = self.location.href; // http://localhost:81/Test/1.htm?Did=123
thisDLoc = document.location; // http://localhost:81/Test/1.htm?Did=123
thisTLoc = top.location.href; // http://localhost:81/Test/1.htm?Did=123
thisPLoc = parent.document.location;// http://localhost:81/Test/1.htm?Did=123
thisTHost = top.location.hostname; // localhost
thisHost = location.hostname; // localhost
thisU1 = window.location.protocol; // http:
thisU2 = window.location.host; // localhost:81
thisU3 = 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( "DidDid="+Request("Did") );// Did=123
</SCRIPT>
- js获取当前Url网址路径及参数 location.hostname
- JS获取当前网址,JS获取当前域名URL ,JS获取网站完整路径页面地址
- js获取当前URL:window.location.href
- js获取当前域名、Url、相对路径和参数
- js获取当前域名、Url、相对路径和参数
- js获取当前url参数
- JS获取当前URL参数
- js获取当前页面url网址信息
- php获取当前域名、主机、URL、端口、参数、网址、路径、代理等
- php获取当前域名、主机、URL、端口、参数、网址、路径、代理等
- php获取当前域名、主机、URL、端口、参数、网址、路径、代理等
- js获取url路径参数
- JS获取当前URL参数参数值
- js获取当前项目根路径URL
- js获取当前路径的url
- AngularJS通过$location获取及改变当前页面的URL
- js 获取当前url所带参数
- js获取当前url的参数值
- 一个工程引用其它工程
- QT 多线程程序设计
- 在Yii中整合Smarty
- SQL查询速度慢的原因分析和解决方案
- 13球3次称重问题
- js获取当前Url网址路径及参数 location.hostname
- WebSphere MQ error (893) has occurred. 的问题
- 图像特征特点及其常用的特征提取与匹配方法
- XML找不到节点的原因
- ArcGIS中的几何对象—— Geometry
- HDOJ 1018 Big Number
- photoshop CS3 打文字时需要鼠标点击一下才显示字,解决办法
- 放弃理想,未必能成就现实
- java中hashcode()和equals()的详解[转]