spacer
Yehuda Shiran June 13, 2000
Modal Windows in Netscape
Tips: June 2000

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
OpenOffice 3.2 Lands Amid Critical Changes
Red Hat, IBM Firmly in KVM Virtualization Camp
Red Hat Talks Up Open Source Cloud Plans

JavaScript features several built-in dialog boxes: window.alert(), window.confirm(), and window.prompt(). When a dialog box pops up, the user cannot focus on the original page until the box is terminated. In other words, a dialog box is always focused. Internet Explorer supports a few methods that enable you to apply this feature to any new window:

showModalDialog() (Internet Explorer 4 and above)
showModelessDialog() (Internet Explorer 5 and above)
You can achieve a similar effect in Navigator by specifying the onBlur event handler:

<BODY onBlur="window.focus()">

If you use the above event handler in the <BODY> tag, the window holding the document remains focused until the user closes it. There are several differences between this Navigator-only technique and Internet Explorer's showModalDialog() method. First of all, the focused window isn't associated with a specific window (or document). That is, the user cannot bring up any other browser window, even if it isn't the window that opened the dialog window. In addition, the user can still bring up a different window for a moment, which is enough to close the opener window while the "modal" dialog is open.

For more on modal windows, go to Working with Windows - Dialog Boxes.


People who read this tip also read these tips:

Look for similar tips by subject:


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers

webref The latest from WebReference.com Browse >
Search Engine Optimization: Selecting and Embedding Keywords · Are Google's Language Translation Web Services Ready for Prime Time? · Installing and Using Meeplace, the Business Review CMS
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Workers Say Telework Is More Productive, Bosses Not So Sure · Kingston Debuts Power-Saving Memory Upgrades · Social Networking is King: Facebook Edges Google