jQuery 如何使用jsp或jquery打开弹出窗口?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15612213/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 15:25:28  来源:igfitidea点击:

how to open popup window using jsp or jquery?

javascriptjqueryjsp

提问by Java Developer

In my Program have one hiperlink ..

在我的程序中有一个超链接..

when we click hiperlink a small popup will open and ask name and this name sending using form.

当我们点击 hiperlink 时,会打开一个小弹出窗口,询问姓名和这个姓名使用表单发送。

So how to create popup using jsp or javascript or jquery?

那么如何使用 jsp 或 javascript 或 jquery 创建弹出窗口呢?

回答by

You can use window.open for this

您可以为此使用 window.open

window.open("page url",null,
"height=200,width=400,status=yes,toolbar=no,menubar=no,location=no");

have a look at this link.. window.open

看看这个链接.. window.open

回答by AGB

The following JavaScript will open a new browser window, 450px wide by 300px high with scrollbars:

以下 JavaScript 将打开一个新的浏览器窗口,450 像素宽 x 300 像素高,带有滚动条:

window.open("http://myurl", "_blank", "scrollbars=1,resizable=1,height=300,width=450");

You can add this to a link like so:

您可以将其添加到链接中,如下所示:

<a href='#' onclick='javascript:window.open("http://myurl", "_blank", "scrollbars=1,resizable=1,height=300,width=450");' title='Pop Up'>Pop Up</a>

回答by PSR

<a href="javaScript:{openPopUp();}"></a>
<form action="actionName">
<div id="divId" style="display:none;">
UsreName:<input type="text" name="userName"/>
</div>
</form>

function openPopUp()
{
  $('#divId').css('display','block');
$('#divId').dialog();
}

回答by Rohan Kumar

Try this:

尝试这个:

SCRIPT:

脚本:

function winOpen()
{
    window.open("yourpage.jsp");
}

HTML:

HTML:

<a href="javascript:;" onclick="winOpen()">Pop Up</a>

Read https://developer.mozilla.org/en/docs/DOM/window.openfor window.open

阅读https://developer.mozilla.org/en/docs/DOM/window.openwindow.open

回答by Prateek Shukla

Can be done with in jquery-

可以在 jquery 中完成 -

<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css" />
    <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
    <script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js"></script>
    <link rel="stylesheet" href="/resources/demos/style.css" />
    <script>
    $(function() {
    $( "#dialog" ).dialog();
    });
    </script>

    <div id="dialog" title="Basic dialog">
    //your form layout
    </div>