
常用软件类: |
|杀毒安全 | |联络聊天 | |网络软件 | |多媒体类 | |系统工具 | |图形图像 | |系统工具 | |应用软件 | |行业软件 |
开发设计类: |
|动画制作 | |图像处理 | |3D设计 | |操作系统 | |站长学院 | |网络相关 | |WEB设计 | |数据库类 | |程序开发 |
Javascript实现获取页面URL技巧
设置或获取对象指定的文件名或路径。
<s cript>
alert(window.location.pathname)
</s cript>
设置或获取整个 URL 为字符串。
<s cript>
alert(window.location.href);
</s cript>
设置或获取与 URL 关联的端口号码。
<s cript>
alert(window.location.port)
</s cript>
设置或获取 URL 的协议部分。
<s cript>
alert(window.location.protocol)
</s cript>
设置或获取 href 属性中在井号“#”后面的分段。
<s cript>
alert(window.location.hash)
</s cript>
设置或获取 location 或 URL 的 hostname 和 port 号码。
<s cript>
alert(window.location.host)
</s cript>
设置或获取 href 属性中跟在问号后面的部分。
<s cript>
alert(window.location.search)
</s cript>