HOWTO: Use Modal Browser Windows With Internet ExplorerID: Q221590
|
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.
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.
<html>
<head><title>Demo modal dialog</title></head>
<script language="JavaScript">
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;
}
</script>
<body>
<p>Hello, your name is <b><span id="Name">Unknown</span></b>.</p>
<p><input type="button" onClick="changeMe(Name.innerText)" value="Change Name"></p>
</body>
</html>
<html>
<head><title>Enter your name</title></head>
<script language="JavaScript" for="window" event="onLoad">
Name.value = window.dialogArguments;
</script>
<script language="JavaScript">
function closeMe()
{
window.returnValue = Name.value;
event.returnValue = false;
window.close();
}
</script>
<body>
<p><input type="text" name="Name" value=""></p>
<p><input type="button" value="Submit" onClick="closeMe()"></p>
</body>
</html>
http://msdn.microsoft.com/scripting/
Additional query words:
Keywords :
Version : WINDOWS:4.0,5
Platform : WINDOWS
Issue type : kbhowto
Last Reviewed: March 31, 1999