JS 中document.URL 和 windows.location.href 的区别
来源:互联网 发布:免费制作电子书软件 编辑:程序博客网 时间:2024/05/16 10:18
JS 中document.URL 和 windows.location.href 的区别 实际上,document 和 windows 这两个对象的区别已经包含了这个问题的答案。document 表示的是一个文档对象,windows 表示一个窗口对象。一个窗口下面可以有很多的document对象。每个document 都有 一个URL。 但是,这不是所有的区别。当你ctrl + F5 一个链接 http://yourhost.com/#fragment打印 alert(document.URL ); 和 alert(windows.location.href);发现,这两个的值不一样, document.URL 的值是 “http://yourhost.com/”windows.location.href 的值是 “http://yourhost.com/#fragment” 差一个 #fragment 所以,如果要用 fragment 进行相应的处理的话,最好是用 windows.location.href否则会出现很奇怪的错误。
- JS 中document.URL 和 windows.location.href 的区别
- JS 中document.URL 和 windows.location.href 的区别
- JS document.URL , windows.location.href 的区别
- document.location.href 和window.location.href的区别
- Document.location.href和.replace的区别
- Document.location.href和.replace的区别
- Document.location.href和.replace的区别
- location.href="#"与document.url ="#"的区别
- location.href="#",document.URL="#"与document.url="#"的区别
- location和location.href跳转url的区别
- location和location.href跳转url的区别
- location和location.href跳转url的区别
- location和location.href跳转url的区别
- location和location.href跳转url的区别
- document.location.reload和document.location.href的比较
- javascript中window.location和window.location.href的区别
- js中的 window.location、document.location、document.URL 对像的区别
- js中的 window.location、document.location、document.URL 对像的区别
- 哈哈 厉害
- 预编译Pre-Compilation
- 集群LVS的调度算法
- 服务器问题故障排除一例
- 课堂小练习(指针问题)
- JS 中document.URL 和 windows.location.href 的区别
- eclipse中,新建文件时的编码问题
- ssh
- 字符串替换(新开辟空间)
- 关于eclipse调试(包括汇编显示)
- i718 触屏坏了,怎么解锁
- OpenCV中Mat与IplImage和CvMat类型之间的相互转换
- java引用自己本身
- Oracle左(外)、右(外)、全(外)、(内)连接语法与SQL标准的比较