[Javascript] Null Parent

Flavio Gomes flavio at economisa.com.br
Fri Jul 9 08:37:42 CDT 2004


  From the just created window I think that "opener" would be the right 
name for it's /parent/.

opener.parent.browserFrame.document
  |      |          |
  |      |          =----> the Frame
  |      =---------> the Frameset
  =--------> the window.open Caller

---
Flavio Gomes
flavio at economisa.com.br



tsterlin at email.arizona.edu wrote:

>I am dynamically building a page into a frame called browserFrame which is
>built when another page called Group.html loads.  I am attempting to add a pop
>up box link to this dynamically built page.  It's nearly impossible to follow
>this description so here is the code for Group.html:
>
><html>
>  <SCRIPT language="JavaScript">
>    function setLinks() {
>      var newPage = "<html>"
>      newPage += "<LINK REL='Stylesheet' HREF='ASLAV.css' TYPE='text/css'/>"
>      newPage += "<SCRIP"
>      newPage += "T LANGUAGE='JavaScript'>"
>      newPage += "function popUp(){"
>      newPage += "window.open    ('Ch2Alerts.html', 'AlertWindow',
>'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=600,height=600,left=340,top=212');"
>      newPage += "} popUp();</S"
>      newPage += "CRIPT>"
>      newPage += "<table align='center'><tr><td>"
>      newPage += "<a href='Maingrp3.html' target='docFrame'>"
>      newPage += "\n<p class='back'>Back</p></a></td>"
>      newPage += "<td><a href='Group2.html' target='docFrame'>"
>      newPage += "\n<p class='next'>Next</p></a></td>"
>      newPage += "<td>"
>      newPage += "<a href='javascript:popUp()'>"
>      newPage += "<p class='alert'>"
>      newPage += "Alerts</p>"
>      newPage += "</a>"
>      newPage += "</td>"
>      newPage += "</tr></table>"
>      newPage += "</html>"
>
>      parent.browserFrame.document.write(newPage)
>      parent.browserFrame.document.close()
>  }</SCRIPT>
>  <body onLoad="setLinks()">
>    <DIV class="body">
>      Some verbage for the group page.
>    </DIV>
>  </body>
></html>
>
>  So essentially what I want is this newPage to open up in browserFrame each
>time Group.html loads.  Then I want the 'Alerts' on newPage to link to a pop-up
>box.  All works well except I'm getting a Runtime error every time I click on
>the Alerts link and the pop-up box appears; it says this:  "Error:
>'parent.browserFrame.document' is null or not an object".
>
>Strangely enough, before I added the pop-up box functionality and had the
>newPage appearing in a normal frame everything worked fine with no Runtime
>errors.
>
>Any insight would be greatly appreciated,
>Tracy:-)
>  
>



More information about the Javascript mailing list