2010-02-20 26 views

回答

1

我沒有鑽研到你的代碼深,但嘗試改變

<form name="searchForm"> 

<form name="searchForm" target="_blank"> 

應在新窗口中打開它。

+0

仍然沒有工作.. :( – 2010-02-20 13:31:54

+0

可以告訴你一個活生生的例子? – 2010-02-20 13:34:02

+0

這是http://javascript.internet.com/forms/multiple-search-engine.html活生生的例子。 – 2010-02-22 11:42:41

3

看來,在你的情況下,表單提交到一個新的標籤,而不是一個新的窗口。可以通過設置新窗口的寬度和高度來強制新窗口,但您必須知道彈出窗口阻止程序可以阻止此操作。另外,不要忘記在表單中將目標屬性設置爲_blank,以便在js停用的瀏覽器中優雅地降級。

<script type="text/javascript"> 
// frm is a reference to the FORM element 
function frm_sbmit(frm) { 
    wnd = window.open("about:blank", "_blank", "width=1024px, height=768px, + put here everithing you want in options for the new window, a good guide is http://www.w3schools.com/jsref/met_win_open.asp"); 
    frm.target = wnd; 
    frm.submit(); 
} 
</script> 
<form action="url" target="_blank" method="post" onsubmit="frm_sbmit(this);return false;"> 
... 
</form> 
+0

+1,看起來像要走的路。 – 2010-02-22 11:57:43

+0

那麼如何在新標籤中打開搜索結果? – 2010-03-25 13:15:15