Print Page | Close Window

simple JS error, need help

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Web Design Discussion
Forum Description: Discussion on web design and development subjects.
URL: https://forums.webwiz.net/forum_posts.asp?TID=7282
Printed Date: 29 March 2026 at 6:48am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: simple JS error, need help
Posted By: Gullanian
Subject: simple JS error, need help
Date Posted: 14 November 2003 at 6:36pm

Hi im making this chat thing, and I think it would stop the images blinking if I only refresh the messages and images if there has been a change, not all the time so I put this simple if in:

function flip_div()

{

parent.fresher.history.go(0);

If (parent.screenO.document.body.innerHTML != parent.fresher.document.body.innerHTML)

{

parent.screenO.document.body.innerHTML = parent.fresher.document.body.innerHTML;

}

}

Can anyone tell me why im getting an object expected error on the 'IF' line, the actual refresh works fine, so why cant it find the object in the if line? 




Replies:
Posted By: Flamewave
Date Posted: 19 November 2003 at 11:56am

Maybe try using window.top.document instead of parent.screen, window.top is also compatible with all browsers, where the parent object isn't. Netscape doesn't see iframes as child objects (im assuming this is an extension to the refreshing script I helped you with earlier that used iframes), so the code above will never work in netscape. I think IE has problems with the parent/child relationships sometimes too, as I remember doing something similar where I had to use window.top instead of parent to get it to work in any browser.

Also, when executing the script from the same frame as what you need the innerHTML of, you can access it with document.body.innerHTML instead of putting the window/frame id/name in front of it.



-------------
- Flamewave

They say the grass is greener on the other side, but if you really think about it, the grass is greener on both sides.


Posted By: lovinglgz
Date Posted: 28 November 2003 at 4:21am

I agree with above

 




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net