Microsoft KB Archive/221590

= How To Use Modal Browser Windows With Internet Explorer =

Article ID: 221590

Article Last Modified on 8/8/2007

-

APPLIES TO


 * Microsoft Internet Explorer 5.0
 * Microsoft Internet Explorer 4.0 128-Bit Edition

-



This article was previously published under Q221590



SUMMARY
Internet Explorer 4.0 and above provide a rich set of programming features to Web authors through Dynamic HTML (DHTML) scripting. One of the more features allows with DHTML is to launch modal child windows and pass variables between the two windows.



MORE INFORMATION
The following code examples show how to launch a child window to prompt for a value and then return that value to the parent window.   Save the following page to your desktop as Modal1.htm:

Demo modal dialog  function changeMe(szName) {   var szUrl; var szFeatures;

szUrl = 'modal2.htm'; szFeatures = 'dialogWidth:20; dialogHeight:10; status:0; help:0';

szName = window.showModalDialog(szUrl, szName, szFeatures) Name.innerText = szName; } Hello, your name is  Unknown .    Next, save the following page to your desktop as Modal2.htm:

Enter your name  Name.value = window.dialogArguments;  function closeMe {   window.returnValue = Name.value; event.returnValue = false; window.close; }    Now browse the file named Modal1.htm:

 The page is displayed showing "Unknown" for a user name.</li> Click the "Change Name" button.</li> The changeMe function is called and the current name is passed to the child window in Window.dialogArguments.</li> Enter a name in the text box in the child window and click the "Submit" button.</li> The closeMe function of the child window is called. This returns the new value in Window.returnValue and closes the child.</li> The parent page retrieves the return value and displays it dynamically.</li></ol> </li></ol>

For more information on Microsoft's scripting technologies, please see the following web site:

http://msdn2.microsoft.com/en-us/library/ms950396.aspx

Keywords: kbhowto KB221590

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.