javascript 如何在 JSF 中打开弹出窗口

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17161651/
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-10-27 07:19:41  来源:igfitidea点击:

How can I open a Popup in JSF

javascriptjsfprimefaces

提问by NDeveloper

I need to open a Popup window on clicking a button in a xhtml page. I have written something like that:

我需要在单击 xhtml 页面中的按钮时打开一个弹出窗口。我写过这样的东西:

<p:commandButton type="submit" value="Select User" onclick="showGrpMemberSearchPageCalenderLeave()"/>

and the java script is like:

和java脚本是这样的:

function showGrpMemberSearchPageCalenderLeave()
{
    window.open('./SearchGroupMembersLeaveCalander.xhtml,resizable=no,
    toolbar=no,scrollbars=yes,height=450,width=530,top=145,left=235');

    return true;
}

But it just opens the page in the current window, no pop up window is opening.Please suggest.

但它只是在当前窗口打开页面,没有打开弹出窗口。请建议。

回答by Markipe

try this one instead

试试这个

function showGrpMemberSearchPageCalenderLeave() { 
     window.open('./SearchGroupMembersLeaveCalander.xhtml','mywindow', 'resizable=no,toolbar=no,scrollbars=yes,height=450,width=530,top=145,left=235');
     return true;
 }

Syntax

句法

window.open(url, windowName, specs);