2012-04-22 38 views
0

的新彈出式窗口中打開窗體我創建了新窗體並將一些參數傳遞給另一個頁面的按鈕;但我需要提交按鈕來打開新的彈出窗口,其大小符合規格。在大小爲

這是我如何通過超鏈接;我需要相同的功能的按鈕

out.println("<a onclick=\"window.open(this.href,this.target,'height=500, scrollbars=1, width=950, resizable');return false;\" target=\"_blank\" href=\"chart.jsp?room=" + B.getNumber() + "&building=" + B.getBuilding() + "\">view chart</a>"); 
+0

我已經添加了[tag:javascript]標籤,因爲如果沒有它,我不認爲這是可能的,並且似乎幾乎是最重要的標籤,肯定在[tag:new-window]之上(它具有零追隨者),或[tag:submit]標​​籤(至少有5個)。 – 2012-04-22 04:38:56

回答

1

我能想到的最簡單的方法是不使用在線的JavaScript:

var form = document.getElementsByTagName('form')[0]; // or any other way to identify the form 

form.onsubmit = function(e) { 
    var eTarget = e.target; 
    window.open(eTarget.action, eTarget.name, 'height=500, scrollbars=1, width=950, resizable'); 
    return false; 
};​ 

JS Fiddle proof of concept