homepage Welcome to WebmasterWorld Guest from 54.205.241.107
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
Change div in parent window
Error ..... Has no properties
humpg

10+ Year Member



 
Msg#: 3286473 posted 5:18 pm on Mar 19, 2007 (gmt 0)

I currently have a page that runs a function to open a popup window:

function StartApp() {

window.open('login.asp','', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=750,height=550,left=100, top=100');
document.getElementById("launcher").style.zIndex = 1;
document.getElementById("running").style.zIndex = 2;

}

This function opens the window and changes the z-index of two divs on this page. This all works fine.

In the popUp window I have this code:

function cleanUp() {
parent.document.getElementById("running").style.zIndex = 1;
parent.document.getElementById("launcher").style.zIndex = 2;
}

This function is called in

<body onunload="javascript:cleanUp();">

But it doesn't change the z-index on the parent window when I close the popUp.

I get an error message in firefox saying:

Error: document.getElementById("running") has no properties

Any one know what I am doing wrong? or is this possible?

 

Moby_Dim

10+ Year Member



 
Msg#: 3286473 posted 8:05 pm on Mar 19, 2007 (gmt 0)

I did not try this before (disclaimer ;), but what if to try window.opener... instead of parent...?

Moby_Dim

10+ Year Member



 
Msg#: 3286473 posted 8:19 pm on Mar 19, 2007 (gmt 0)

I've just tried this with fontSize and color, and it worked.

humpg

10+ Year Member



 
Msg#: 3286473 posted 11:32 am on Mar 20, 2007 (gmt 0)

Thanks a bunch Moby_Dim,

window.opener.document.... worked perfectly

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved