gpt4 book ai didi

javascript - 使用javascript打开子窗口时禁用父窗口

转载 作者:行者123 更新时间:2023-11-30 18:09:45 25 4
gpt4 key购买 nike

  • 我有一个名为 worklist.jsp 的父窗口
  • 父窗口有一个按钮。单击按钮时,它会调用名为 getEventLogUser() 的函数。
  • getEventLogUser() 函数依次调用名为 popupWindowWithPost() 的函数来打开子窗口。这两个函数都在单独的 js 文件中 (utility.js)..
  • 我的需要是,我必须在打开子窗口时禁用父窗口。

工作列表.jsp:

<div class="claro" id="menuDiv21" onclick="setWidgetproperty(this.id,'x','navMenu21');" onmousedown="setMenuBarProperty('navMenu21');" onmouseup="setDocStyle(this.id)" style="border:1px dotted white; left: auto; position: absolute; top: 620px;">
<div dojotype="dijit.MenuBar" id="navMenu21" style="font-size:11pt;" title="MenuBar">
<div dojotype="dijit.MenuBarItem" id="SearchMenu21" onclick="getEventLogUser();setMenuId(this.id);" style="font-size:11pt;" title="menuBarItem">
<img class="images" id="SearchMenu21" name="search5.png" onclick="setImgProperty(this.id)" src="images/uploads/search.png" style="height:20px; width:20px;">
Search
</div>
</div>
</div>

实用程序.js:

function getEventLogUser(){
var dummyvar = document.getElementById("CWPROCESSEVENTLOG.OBJECT_ID").value;
popupWindowWithPost("eventLogUser.jsp",'height=600px,width=960px,top=50px,left=150px,scrollbars=no,sizable=yes,toolbar=no,statusbar=no','processManager',dummyvar);
}
function popupWindowWithPost(url, windowoption, name, params)
{
var form = document.createElement("form");
form.setAttribute("method", "post");
form.setAttribute("action", url);
form.setAttribute("target", name);
var input = document.createElement('input');
input.type = 'hidden';
input.name = "PARAM";
input.value = params;
form.appendChild(input);
document.body.appendChild(form);
window.open(url, name, windowoption);
form.submit();
document.body.removeChild(form);
}

最佳答案

禁用窗口的一种简单方法(假设您对禁用的定义符合我上面的评论)是简单地用一个不可见的 div 覆盖窗口并给它一个非常大的 z-index,这样如果您有任何其他 dom 元素一个 z-index > 1 它仍然会被那个不可见的 div 覆盖..

尽量避免像 window.showModalDialog() 这样的东西,它们是 bad news ..如果我是你..我什至不会创建一个新窗口,除非它是绝对必要的(老实说,我想不出一个单一的场景)..我只会在同一个窗口中使用div 和 css.. 在线有大量教程和库(即 twitter bootstrap)。

关于javascript - 使用javascript打开子窗口时禁用父窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14888523/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com