You are here: irt.org | FAQ | JavaScript | Window | Q1786 [ previous next ]
MainWindow orginally has or does not have frames. It has a button to open a new pop-up window containing links. When you click the links in Popup, they appear in MainWindow, creating frames, and making Popup disappear.
MainWindow.html contains in the Head:
<script LANGUAGE="JavaScript"> function win(fileName) { myPopup = window.open('','MapWin','scrollbars=yes,toolbar=no,location=no,status=yes,resizable=yes,width=500,height=500,screenX=5,screenY=1,top=1,left=5') myPopup.location.href = fileName; if (myPopup.opener == null) myPopup.opener = self; myPopup.focus(); } //--> </script>
In the Body:
<a href="javascript:win('popup.html','window')" border="0" src="image.gif"></a>
Popup.html contains in the Head:
function win1(fileName) { //Open MainWindow with frames var framewin = opener.parent with (framewin.document) { write("<html>"); write('<frameset rows="115,526*" frameborder="NO" border="0" framespacing="0" cols="*">'); write('<frame name="topFrame" scrolling="NO" marginwidth="0" marginheight="0" noresize src="heading_frame.html">'); write('<frame name="mainFrame" src="'+ fileName +'">'); write("</frameset></html>"); } // Close Pop-up window after linking self.close(); }
In the Body:
<A HREF="javascript:win1('somepage.html')"Some Link Goes Here"</A>"
Submitted by Mary Rice