Popup Controlled By Frameset Focus

[Total: 0    Average: 0/5]

This example allows you to open up a popup and detech if it is closed.

Body Code:

<!--
1. This is the main frameset file - call it anything you like

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
	<title>Untitled</title>
<script>
var _start="<HTML><HEAD><TITLE>My Page</TITLE></HEAD><BODY onunload='opener._win=null;'>";
var _end="</BODY></HTML>";
var _page=new Array();
    _page[1]=_start+"One is a lonely number."+_end;
    _page[2]=_start+"Two is a nice pair"+_end;
    _page[3]=_start+"Three often leaves out one - isn't that lonely"+_end;
var _win=null;
function closeWin()
{
  if(_win && !_win.closed && _win.open)
  {
      _win.close();
	  _win=null;
  }
}
function openWin(i)
{
  closeWin();
  _win=window.open();
  _win.document.open();
  _win.document.write(_page[i]);
  _win.document.close();
  _win.focus();
}

</script>
</head>
<frameset>
<frame name=f1 src="frame_f1.html">
</frameset>
</html>

-->


<!--
2. this is file two call it frame_f1.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
	<title>Untitled</title>
</head>

<body onload=top.closeWin(); onfocus=top.closeWin();>

inside frame f1
<HR>
<a href=javascript:top.openWin(1)>click to open window #1</a><BR>
<a href=javascript:top.openWin(2)>click to open window #2</a><BR>
<a href=javascript:parent.openWin(3)>click to open window #3</a><BR>


</body>
</html>

-->



Times Viewed: 0

Leave a Reply

Your email address will not be published. Required fields are marked *