2

我能够找到一种关于模态窗口的解决方案,这是链接:简单的 jQuery 模态窗口示例。但是,我特别想要的是:

  • 我想将 b.jsp 作为简单窗口模式打开,就像上面那个网站链接中给出的那样。
  • 单击提交按钮后,我希望 b.jsp 以这种方式打开。

我尝试了几种解决方案,但我无法让它以同样的方式工作。

下面是我的代码:

a.jsp

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

1 回答 1

2

使用 JQuery UI 非常简单。

我做了一些改变:

将类型更改为按钮,因为您不需要加载 html 的提交表单。

<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 });
    });
});

我希望这对你有帮助

于 2012-02-29T13:13:54.567 回答