Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - simple JS error, need help
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Topic Closedsimple JS error, need help

 Post Reply Post Reply
Author
Gullanian View Drop Down
Senior Member
Senior Member
Avatar

Joined: 04 January 2002
Location: England
Status: Offline
Points: 4373
Direct Link To This Post Topic: simple JS error, need help
    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? 

Back to Top
Flamewave View Drop Down
Senior Member
Senior Member
Avatar

Joined: 19 June 2002
Location: United States
Status: Offline
Points: 376
Direct Link To This Post 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.
Back to Top
lovinglgz View Drop Down
Newbie
Newbie
Avatar

Joined: 28 November 2003
Location: China
Status: Offline
Points: 1
Direct Link To This Post Posted: 28 November 2003 at 4:21am

I agree with above

 

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.