Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q1786 If I use a button to create a pop-up screen with links, how do I get the links to open in the orginal main window, creating frames and make the pop-up disappear?

irt.org | Knowledge Base | JavaScript | Window | Q1786 [ previous next ]

Q1786 If I use a button to create a pop-up screen with links, how do I get the links to open in the orginal main window, creating frames and make the pop-up disappear?

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


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.