2010-12-13 66 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> 
相關問題