2012-02-29 97 views
2

我能夠找到一個有關模態窗口的解決方案,這裏是鏈接:Simple jQuery Modal Window Examples。不過,我特別想要的是:在jsp中打開模式窗口

  • 我想打開b.jsp作爲簡單窗口模式,就像上面那個網站鏈接中給出的那樣。
  • 點擊提交按鈕後,我希望以這種方式打開b.jsp。

我嘗試了幾個解決方案,但我無法讓它以相同的方式工作。

這裏是我下面的代碼:

a.jsp 

<form action="b.jsp"> 
<input type="submit" value"click here to open modal window"/> 
</form> 

回答

2

使用jQuery UI是很容易的。因爲你鴕鳥政策負載HTML NEE sudmit形式

變更類型按鈕:

我做一些改變。

<div id="resultreturn" style="display: none"></div> 
<form > 
<input type="button" value="click here to open modal window" id="loader"/> 
</form> 

後來我綁定一個事件單擊此事件:

$(document).ready(function(){ 
    $("#loader").click(function(){ 
       // Load the page into the div 
     $("#resultreturn").load("b.html"); 
       // Show the modal dialog 
     $("#resultreturn").dialog({ modal: true }); 
    }); 
}); 

我希望這可以幫助您