Click here to Skip to main content
14,105,616 members
Click here to Skip to main content
Add your own
alternative version


25 bookmarked
Posted 19 Mar 2006

Modal popup Window

, 19 Mar 2006
Rate this:
Please Sign up or sign in to vote.
Creating a modal popup Window


Internet Explorer and Mozilla based browsers (FireFox etc.) allow you to make a pop-up window modal. For Internet Explorer, you can use the showModalDialog method. For Mozilla based browsers, you can use with parameter "modal" to open a window that stays in front of the original window.

How it works

Although Internet Explorer and Mozilla based browsers use different methods, you don't need to test which browser you are currently running. Instead you can test for support for the showModalDialog method. The code looks like this:

if (window.showModalDialog)
    var dialogArguments = new Object();
    var _R = window.showModalDialog("popup.html", dialogArguments, ...
else //NS   
    ..."popup.html", ID, "modal,toolbar=false...

The code

To see an example, you can download the source files and double-click the default.html. The example shows you how to create a modal popup Window, as well as how to pass back popup Window textbox value to the parent Window.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

william s. su
Web Developer
United States United States
William is currently working for Toshiba. His programming experience includes C/C++, C#, MFC, Java, ASP.NET and SQL. His Internet experience includes XML, SOAP and UI design. He is MCSD.NET, MCDBA and MCT certified and has a MS degree in CS.

Willaim was born in Taiwan but lives in USA. For relaxation he enjoy traveling and art.

You may also be interested in...

Comments and Discussions

GeneralMy vote of 1 Pin
vsbijin6-Dec-13 23:42
membervsbijin6-Dec-13 23:42 
GeneralRe: Working Modal Window Example Pin
Manie Verster5-Dec-08 1:00
memberManie Verster5-Dec-08 1:00 
GeneralDoes not work on Firefox Pin
joyvinod9-Jul-07 23:22
memberjoyvinod9-Jul-07 23:22 
GeneralHello William! We are your friends from Philippines. Pin
jamzero17-Jan-07 22:02
memberjamzero17-Jan-07 22:02 
GeneralYou may want to have a look for an alternative approach Pin
volkan.ozcelik10-Dec-06 0:42
membervolkan.ozcelik10-Dec-06 0:42 
GeneralDoes not work with Firefox 2.0 Pin
facorreia27-Oct-06 3:28
memberfacorreia27-Oct-06 3:28 
GeneralRe: Does not work with Firefox 2.0 Pin
jpatexor5-Dec-06 19:15
memberjpatexor5-Dec-06 19:15 
Generalcan't work appropriate in FF and NN Pin
buger.game8-Apr-06 21:40
memberbuger.game8-Apr-06 21:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web03 | 2.8.190518.1 | Last Updated 19 Mar 2006
Article Copyright 2006 by william s. su
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid