| | |
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
![]() |
•
•
Join Date: Sep 2008
Posts: 6
Reputation:
Solved Threads: 0
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)
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)
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:
You can replace the <p> in there with whatever you want loaded in case the browser doesn't support flash.
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:
html Syntax (Toggle Plain Text)
<object type="application/x-shockwave-flash" data="WEBSITE/logo.swf" width="293" height="110"> <param name="movie" value="WEBSITE/logo.swf" /> <param name="quality" value="high"/> <p>No flash player!</p> </object>
Last edited by Atli; Sep 14th, 2008 at 5:05 am. Reason: Spelling
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.
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.
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.

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.
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.
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.
![]() |
Similar Threads
- CSS not working in FireFox (HTML and CSS)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Sum the form values
- Next Thread: Javascript and Drop down menu display price
Views: 4172 | Replies: 9
| Thread Tools | Search this Thread |
Tag cloud for JavaScript / DHTML / AJAX
acid2 ajax ajaxcode ajaxhelp animate array automatically autoplay beta boarder box bug button calendar captcha card cart codes column cookies createrange() css cursor date debugger decimal design developer dom download dropdown element enter error events firefox firehose flash focus form frameworks getselection google gwt html htmlform iframe image() index java javascript javascripts jawascriptruntimeerror jquery jsp listbox maps marquee masterpage menu microsoft mimic mp3 mp4 offline onmouseover parameters php player post problem programming progressbar prototype rating redirect regex safari scale scriptlets search select size sources sql starrating text textarea toggle twitter validation variables w3c web website window windowofwords windowsxp xml xspf





