body onLoad not working in IE7

Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Reply

Join Date: Sep 2008
Posts: 6
Reputation: gailhands is an unknown quantity at this point 
Solved Threads: 0
gailhands gailhands is offline Offline
Newbie Poster

body onLoad not working in IE7

 
0
  #1
Sep 13th, 2008
Hi,

Really new to AJAX, attempting to load the first page content into a div on the website loading using an onLoad property to the body tag .

This is working in FF but not in IE7. Any help much appreciated!

Thanks

Gail. (http://www.pure-connections.com)
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 455
Reputation: Atli is on a distinguished road 
Solved Threads: 56
Atli's Avatar
Atli Atli is offline Offline
Posting Pro in Training

Re: body onLoad not working in IE7

 
0
  #2
Sep 14th, 2008
Hi.

The onload event and the AJAX code it executes looks like it's working fine.

The problem is that the onload event is not triggered until everything on the page has been loaded and the JavaScript in your "layer18" <div> appears not to be working as it should. In IE it just seems to freeze, preventing the page from loading completely. So the onload even is never triggered.

That JavaScript appears to be loading a flash movie.
Try replacing it with something like:
  1. <object
  2. type="application/x-shockwave-flash"
  3. data="WEBSITE/logo.swf"
  4. width="293" height="110">
  5. <param name="movie" value="WEBSITE/logo.swf" />
  6. <param name="quality" value="high"/>
  7. <p>No flash player!</p>
  8. </object>
You can replace the <p> in there with whatever you want loaded in case the browser doesn't support flash.
Last edited by Atli; Sep 14th, 2008 at 5:05 am. Reason: Spelling
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 6
Reputation: gailhands is an unknown quantity at this point 
Solved Threads: 0
gailhands gailhands is offline Offline
Newbie Poster

Re: body onLoad not working in IE7

 
0
  #3
Sep 14th, 2008
Hi,

Thanks for your quick repsonse!

I have removed the "layer18" div but the onload event still doesnt seem to be triggering in IE7? It is still working perfectly in Firefox
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 455
Reputation: Atli is on a distinguished road 
Solved Threads: 56
Atli's Avatar
Atli Atli is offline Offline
Posting Pro in Training

Re: body onLoad not working in IE7

 
0
  #4
Sep 14th, 2008
That's weird.

I tried this on my private server. Copied all your code there and tested in all browsers... They all worked without any problems.
But the same code on your server doesn't work.

The only thing I see wrong in the code is that the onLoad event should be spelled all lower-case, but that shouldn't be causing this sort of a problem.

It's almost like IE is expecting more data.
Perhaps you could try setting the "Connection: close" header at the top of the page. If you server can handle PHP that would be easy.

But if all else fails, you could always just add a <script> block right before you close the </body> that does what the onload is supposed to do... it's not pretty but it will definitely work.
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 455
Reputation: Atli is on a distinguished road 
Solved Threads: 56
Atli's Avatar
Atli Atli is offline Offline
Posting Pro in Training

Re: body onLoad not working in IE7

 
0
  #5
Sep 14th, 2008
Ahh no ok I figured it out
It's your welcome.html page. It does get loaded, but it's rendered *incorrectly*.

You are adding the entire content of that page into the current page, and because the included page also contains <html>, <body> and <style> tags, IE won't parse it correctly.

You need to change that. Add the styles in the welcome page to the global index.css file and remove the <html> - <body> tags, so that the welcome file only contains the markup you need added into the current page.
Last edited by Atli; Sep 14th, 2008 at 7:23 am.
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 6
Reputation: gailhands is an unknown quantity at this point 
Solved Threads: 0
gailhands gailhands is offline Offline
Newbie Poster

Re: body onLoad not working in IE7

 
0
  #6
Sep 14th, 2008
Hi Atli,

Thank you so much for your help.

Going to try that, will let you know!

Cheers

Gail
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 6
Reputation: gailhands is an unknown quantity at this point 
Solved Threads: 0
gailhands gailhands is offline Offline
Newbie Poster

Re: body onLoad not working in IE7

 
0
  #7
Sep 14th, 2008
Cheers Atli! All working now

Thank you!

Gail
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 6
Reputation: gailhands is an unknown quantity at this point 
Solved Threads: 0
gailhands gailhands is offline Offline
Newbie Poster

Re: body onLoad not working in IE7

 
0
  #8
Sep 14th, 2008
Just one little last thing!
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 6
Reputation: gailhands is an unknown quantity at this point 
Solved Threads: 0
gailhands gailhands is offline Offline
Newbie Poster

Re: body onLoad not working in IE7

 
0
  #9
Sep 14th, 2008
Just one little last thing! I have uploaded the content for the aromatherapy massage link. Is it appearing and then shifting into position to the left to you?

I want it to appear in exactly the position it should without having to shift over, if that makes any sense?
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 455
Reputation: Atli is on a distinguished road 
Solved Threads: 56
Atli's Avatar
Atli Atli is offline Offline
Posting Pro in Training

Re: body onLoad not working in IE7

 
0
  #10
Sep 14th, 2008
I'm not sure there is much you can do about that. That's probably just a quirk in the browser while it is rendering the new content.

But, just as with your welcome page, this page has all the <html>, <body> and <style> tags, which will probably cause some rendering issues as well.
Try removing them, see if that solves it.

If it doesn't, you could always try to hide the container <div> and have it appear a few milliseconds after the page loads. That should give the browser time to render it before it is displayed, which would get rid of the "sliding" motion.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum


Views: 4172 | Replies: 9
Thread Tools Search this Thread



Tag cloud for JavaScript / DHTML / AJAX
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC