- For individual users
- Instant access to solutions
- Ask your tech questions
- Start your 30-day Free Trial
Main Topics
Browse All Topics
I am trying to simulate the functionality of modal dialog windows using javascript..
I would do this by invoking the window.focus method of the dialog window whenever the parent window gets focus.
This has worked fine with IE6 and with IE7 ; but with IE 8 - it works well on some workstations; however on other workstations all that happens is that the taskbar button for the dialog window flashes when window.focus() is invoked.. (the dialog window is not brought up to the front)
I open the dialog window like this:
dialogWin =window.open('aform.aspx',
...
I handle the onfocus event of the opener window like this:
if (dialogWin != null && !dialogWin.closed)
{
dialogWin.focus();
}
This has worked well with past versions of IE; however it does not work with IE 8 on some workstations (the button on the taskbar merely flashes)
Is there any other approach I can take? I realize I can use showModalDialog; but this would involve rewriting a lot of code.
Thanks
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: mplungjanPosted on 2009-07-09 at 23:56:56ID: 24820840
Why would it involve a rewrite?
{ ,parms.rep lace(',',' ;').replac e('width', 'dialogWid th').repla ce('height ','dialogH eight'); // add whatever you need
nts
a better choice is to use something like lightbox 2 or thickbox or greybox since it does not involve opening new windows which is blocked on many PCs
If you really want to, you can do
if (window.showModalDialog) window.open=new function(url,target,parms)
var ret = showModalDialog(url,window
return ret
}
so only where you need to manipulate the window afterwards do you need to change stuff and you can do a change of
opener.
to
if (window.dialogArguments) opener=window.dialogArgume
However