Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q1809 How do I make a modal window?

You are here: irt.org | FAQ | JavaScript | Window | Q1809 [ previous next ]

This code is a very simple example that will provide the functionality of a modal window under IE4 / NS4

One problem I have seen is that, if the main document does not take up the entire screen, then clicking outside your document will allow you to return to the main window. This is the reason for the table in the example below.

<HTML>
<HEAD>
<TITLE>Modal Windw Example</TITLE>
<SCRIPT>
var popWindow;

function PopDis(loc) {
  popWindow = window.open (loc,'popdis' ,'status=0,toolbar=0,height=450,width=510,location=0,menu=0,resizable=0,scrollbars=1');
  popWindow.opener = self;
}

function checkPop () {
  if ((popWindow) && (!popWindow.closed)) {
    popWindow.focus();
  }
}
</SCRIPT>
</HEAD>

<BODY onFocus="checkPop();">

<table width=100% height=100%><tr><td>
<form>
<input>
</form>

<A href="javascript:PopDis('test2.html')">Open a modal window</a>

</td></tr></table>

</body>
</html>

Submitted by Leigh Craig-Browne

©2018 Martin Webb