window.location和window.open做链接的区别

window.location和window.open做链接的区别

一、性质不同

1、window.location:window.location是window对象的属性。

2、window.open:window.open是window对象的方法。

 

二、用途不同

1、window.location:window.location用来替换当前页,也就是重新定位当前页 。

2、window.open:window.open用来让链接页面在窗口中打开。

 

三、打开网站不同

1、window.location:window.location只能在一个网站中打开本网站的网页。

2、window.open:window.open可以在一个网站上打开另外的一个网站的地址 。

 

四、语法

1、window.location:

 

 

2、window.open:

window.open(URL,name,specs,replace)

 

 

 

 

posted @ 2020-03-30 16:53  慕容冰菡  阅读(340)  评论(0编辑  收藏  举报