如何通过单击父窗口上的按钮在子窗口出现时禁用父窗口 [英] How to disable parent window while child window appear by clicking button on parent window

查看:51
本文介绍了如何通过单击父窗口上的按钮在子窗口出现时禁用父窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在jsp中设计了一个窗口,其中有一个搜索按钮.当用户单击搜索"按钮时,将出现新窗口.但是这时我希望禁用父窗口,以便当用户尝试在父窗口上执行任何操作时,除非关闭搜索"表单,否则不允许这样做.

I have designed one window in jsp in which there is a search button. when user clicks "search" button, the new window appears. But at this time i want my parent window to be disable so that when user tried to do anything on parent window it should not allow until "search" form is closed.

如果有人知道该怎么做,那么请告诉我.

If anyone knows how to do this then please let me know.

我已经尝试过此解决方案使用Javascript打开弹出窗口并禁用父窗口,但是此解决方案无法禁用父页面上的链接.而且我不打算使用showmodaldialog.或有人可以通过示例向我解释showdialog()的用法谢谢,rakesh

i have already tried this solution Javascript to open popup window and disable parent window, but this solution is not able to disable the links on the parent page. and I don't intend to use showmodaldialog. Or somebody can explain me the use of showdialog() with an example Thanks, rakesh

推荐答案

function openSearchPopUp() { 
  popupWindow= window.open(url,'window','width=800,
                           height=600,location=yes,
                           menubar=‌​yes,scrollbars=yes,
                           resizable=yes'); 
  popupWindow.focus(); 
  document.onmousedown = focusPopup; 
  document.onkeyup = focusPopup; 
  document.onmousemove = focusPopup; 
} 

function focusPopup() {
  if(popupWindow && !popupWindow.closed) { popupWindow.focus(); } 
} 

这篇关于如何通过单击父窗口上的按钮在子窗口出现时禁用父窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆