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

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
News Flash: Adobe Has iPhone Workaround
Adobe's Flash 10.1 Goes Mobile (Minus iPhone)
A Salute to Visionary CEOs

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:

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Building a Banking Application Home Page with OOP · Mixing Scripting Languages · Review: phpFox, a Social Networking CMS with all the Bells and Whistles
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Enterprise 2.0: Social Networking in the Cloud · BroadSoft Marketplace Hastens Pace of Telephony Innovation · Review: HTC Hero for Sprint