博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
js获取url信息
阅读量:6877 次
发布时间:2019-06-26

本文共 545 字,大约阅读时间需要 1 分钟。

设置或获取对象指定的文件名或路径。alert(window.location.pathname) 设置或获取整个 URL 为字符串。 alert(window.location.href);设置或获取与 URL 关联的端口号码。alert(window.location.port) 设置或获取 URL 的协议部分。alert(window.location.protocol) 设置或获取 href 属性中在井号“#”后面的分段。alert(window.location.hash) 设置或获取 location 或 URL 的 hostname 和 port 号码。alert(window.location.host) 设置或获取 href 属性中跟在问号后面的部分。alert(window.location.search)  获取变量的值(截取等号后面的部分)    var url = window.location.search;//    alert(url.length);//    alert(url.lastIndexOf('='));    var loc = url.substring(url.lastIndexOf('=')+1, url.length);

 

转载地址:http://pwgfl.baihongyu.com/

你可能感兴趣的文章
利用SVG制作不规矩背景的链接导航
查看>>
Linux - 一次运行多个命令
查看>>
10.C# -- 函数参数,参数数组,值传递函数,引用传递函数,输出函数,无参函数...
查看>>
BT5设置ip地址
查看>>
Effective Java读后感
查看>>
我的友情链接
查看>>
我的友情链接
查看>>
德国博世百年风雨启示录(下):实业强国
查看>>
(整理)用Elixir做一个多人扑克游戏 4
查看>>
qcom 跨平台的串口调试工具 PKGBUILD
查看>>
Delphi 时间格式化,动态显示时间,显示最新时间
查看>>
在JAVA中将NEW一分为2,分步进行[反射机制产生类]
查看>>
Java多态性的两个特殊情况
查看>>
我的友情链接
查看>>
怎么改变Win7登陆背景图片
查看>>
虚拟带库和物理带库比较
查看>>
AD委派加域权限
查看>>
在Delphi 7中使用加密的SQLite
查看>>
wordpress 无用的RSS Feed Cache
查看>>
Linux Vi编辑器的基本使用方法
查看>>