代码改变世界

window.open和window.location.href

2017-05-26 16:57  向日葵默默开  阅读(408)  评论(0)    收藏  举报

window.open和window.location.href都是实现页面的跳转,刷新

window.open是在新的窗口打开

  使用格式windows.open("URL","窗口名称","窗口外观设定");

window.location.href是在当前窗口打开,相当于刷新了一遍

当前页面打开url页面有一下几种格式:-->

self.location.href;//当前页面打开URL页面

window.location.href;//当前页面打开URL页面
this.location.href;//当前页面打开URL页面
location.href;// 当前页面打开URL页面
parent.location.href;//在父页面打开新页面
top.location.href;//在顶层页面打开新页面     
 
 
这个写的挺好!
http://www.cnblogs.com/Qian123/p/5345298.html