spacer image Home | My Websites | Javascript Workbench

Quick Printable Instructions
for installing Allen's Modal Dialog Windows


from getyourwebsitehere.com


1. Have the parent (main) window open a standard popup window. All of the functionality for my modal windows resides in the popup window's contents, not the parent window's contents.

Here is a simple, straightforward script for opening a popup window:

<SCRIPT LANGUAGE="JavaScript"><!--
//popup window opener
function openWind(){
url = "popcontent.html";
windowname = "mywindow";
attributes = "height=375,width=325,left=10,top=10,resizable,scrollbars";
windowhandle01 = window.open(url, windowname, attributes);
}
//-->
</SCRIPT>


You can use a form button to call the window opening script:

<form>
<input type="button" value = "Open!" onclick="openWind()">
</form>


2. Add this script to the head section of the popup's html:

<SCRIPT LANGUAGE="JavaScript"><!--
//script for modal window - always on top
var skipcycle = false
function focOnMe(){
if(!skipcycle){window.focus()}
mytimer = setTimeout('focOnMe()', 500);
}
//-->
</SCRIPT>


3. Add this little bit of script to the body statement of the popup:

onload = "mytimer = setTimeout('focOnMe()', 500);"

For example:

<body bgcolor="white" onload = "mytimer = setTimeout('focOnMe()', 500);">

4. Finally, add the following to every form element in the popup:

onfocus="skipcycle=true" onblur="skipcycle=false"

For example:

<input type="text" name="a" size="20" onfocus="skipcycle=true" onblur="skipcycle=false">

That's it!

Close this window.

Jimmy Allen
April 5, 2001



spacer image Home | My Websites | Javascript Workbench