2010-12-13 70 views
0

我在我的代码中使用self.location="www.google.com";打开谷歌页面。我怎样才能在另一个窗口中打开相同的页面。使用self.location在新选项卡中打开页面?

+0

您使用的是什么一个div点击或单击HREF?基于我们可以决定使用哪一个 – kobe 2010-12-13 07:52:27

+0

我只想通过脚本打开,因为我在URL中传递一些值。 – 2010-12-13 07:59:51

+0

ram然后去window.open,这应该是你的情况。 – kobe 2010-12-13 08:02:23

回答

2

您可以使用<a>标签并设置target="_blank"财产重新标签/窗口中打开一个页面。这是否会在新选项卡/窗口中打开完全取决于用户代理中的设置。

<a href="http://www.google.com" target="_blank">Google</a> 
1

试试这个

window.open ("www.google.com","mywindow"); 
0

我看到至少有一个奇特的方法:

<a id='newwnd' href='goole.com' style='display:hidden' target='blank'></a> 
... 
document.getElementById('newwnd').click(); 
1
<script> 
function fullwin(targeturl) { 
window.open(targeturl,"","fullscreen,scrollbars") 
} 
</script> 

<form> 
<input type="button" onClick="fullwin('mypage.html')" value="Show My Frameset"> 
</form> 
相关问题