location.href和window.open有哪些具体用法和区别?
- 内容介绍
- 文章标签
- 相关推荐
本文共计1500个文字,预计阅读时间需要6分钟。
一、location.href几种常见形式:- self.location.href- //当前页面打开URL页面- window.location.href- //当前页面打开URL页面- this.location.href- //当前页面打开URL页面- location.href- //当前页面打开URL页面
一、location.href常见的几种形式
- self.location.href;//当前页面打开URL页面
- window.location.href;//当前页面打开URL页面
- this.location.href;//当前页面打开URL页面
- location.href;// 当前页面打开URL页面
- parent.location.href;//在父页面打开新页面
- top.location.href;//在顶层页面打开新页面
①如果页面中自定义了frame,那么可将parent、self、top换为自定义frame的名称,效果是在frame窗口打开url地址。
②此外,window.location.href=window.location.href;和window.location.Reload();都是刷新当前页面。
区别在于是否有提交数据。
本文共计1500个文字,预计阅读时间需要6分钟。
一、location.href几种常见形式:- self.location.href- //当前页面打开URL页面- window.location.href- //当前页面打开URL页面- this.location.href- //当前页面打开URL页面- location.href- //当前页面打开URL页面
一、location.href常见的几种形式
- self.location.href;//当前页面打开URL页面
- window.location.href;//当前页面打开URL页面
- this.location.href;//当前页面打开URL页面
- location.href;// 当前页面打开URL页面
- parent.location.href;//在父页面打开新页面
- top.location.href;//在顶层页面打开新页面
①如果页面中自定义了frame,那么可将parent、self、top换为自定义frame的名称,效果是在frame窗口打开url地址。
②此外,window.location.href=window.location.href;和window.location.Reload();都是刷新当前页面。
区别在于是否有提交数据。

