1,设置或获取对象指定的文件名或路径。

alert(window.location.pathname)

2,设置或获取整个 URL 为字符串。

alert(window.location.href);

3,设置或获取与 URL 关联的端口号码。

alert(window.location.port)

4,设置或获取 URL 的协议部分。

alert(window.location.protocol)

5,设置或获取 href 属性中在井号“#”后面的分段。

alert(window.location.hash)

6,设置或获取 location 或 URL 的 hostname 和 port 号码。

alert(window.location.host)

7,设置或获取 href 属性中跟在问号后面的部分。

alert(window.location.search)

8,获取变量的值(截取等号后面的部分)

 var url = window.location.search;

//    alert(url.length);

//    alert(url.lastIndexOf('='));

var loc = url.substring(url.lastIndexOf('=')+1, url.length);

9,用来得到当前网页的域名

var domain = document.domain;

stay hungry stay foolish!

最新文章

  1. kettle启动“Error: could not create the Java Virtual Machine”
  2. 如何优雅的使用vue+vux开发app -01
  3. android学习笔记37——Menu资源
  4. 数据库:mongodb与关系型数据库相比的优缺点
  5. JDK - Tomcat - Eclipse - JSP - Servlet 配置运行全攻略
  6. php整理(一):变量和字符串
  7. 犯罪构成三层次记忆口诀 zt
  8. SQL 树结构统计数据
  9. 添加PDF文件对照度的粗浅原理,及方法
  10. zoj 3204 Connect them
  11. java_web学习(四) 二维表的制作(初步接触MVC)
  12. 通过编程为Outlook 2007添加邮件规则
  13. 浏览器解析js的顺序
  14. Java 线程池(ThreadPoolExecutor)原理分析与使用
  15. [Swift]LeetCode1017. 负二进制转换 | Convert to Base -2
  16. 2、Docker基础用法
  17. C# 树状图
  18. SQL 事务 begin tran、commit tran、rollback tran 的用法
  19. Proftpd 服务器安装配置
  20. MediaPlayer音乐播放器、上一首、下一首、播放、停止、自动下一首、进度条

热门文章

  1. 二.navicate
  2. 数据库常用sql
  3. LeetCode习题集
  4. JVM中的GC系统
  5. python之路3:文件操作和函数基础
  6. java post格式发送application/x-www-form-urlencoded
  7. 配置全局路由表和VRF路由表之间的路由泄漏
  8. Python——01.环境及安装
  9. wpf treeview 绑定图标方式
  10. 《基于CNN和SVM的人脸识别系统的设计与实现》论文笔记十六