473,406 Members | 2,387 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Firefox perfect, problems with IE

Hello all, I have this web application up at http://niceguy.wustl.edu/NEISGEI/EmisComp.
It's for visually comparing emission data.

So, I added this nice loading animated gif to the maps to show users
that the image is still downloading (some data can take a couple of
minutes). I found the script somewhere on the web.

Unfortunately, it doesn't work in Internet Explorer (surprise...)

So, I have 3 maps, 3 loading gifs, 3 loading divs. I'm only showing
the addLoadEvent function for one, but here's the script:

document.write('<div id="loading1"><img src="load.gif"></div>');
document.write('<div id="loading2"><img src="load.gif"></div>');
document.write('<div id="loading3"><img src="load.gif"></div>');

function addLoadEvent1(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
if (oldonload) {
oldonload();
}
func();
}
}
}

addLoadEvent1(function() {
document.getElementById("loading1").style.display= "none";
});

Any ideas what the IE problem is?
Thanks!
-Ed

May 23 '07 #1
1 1678
On May 24, 6:45 am, edfialk <edfi...@gmail.comwrote:
Hello all, I have this web application up athttp://niceguy.wustl.edu/NEISGEI/EmisComp.
It's for visually comparing emission data.

So, I added this nice loading animated gif to the maps to show users
that the image is still downloading (some data can take a couple of
minutes). I found the script somewhere on the web.

Unfortunately, it doesn't work in Internet Explorer (surprise...)

So, I have 3 maps, 3 loading gifs, 3 loading divs. I'm only showing
the addLoadEvent function for one, but here's the script:

document.write('<div id="loading1"><img src="load.gif"></div>');
document.write('<div id="loading2"><img src="load.gif"></div>');
document.write('<div id="loading3"><img src="load.gif"></div>');
It is more efficient to concatenate the strings and call
document.write once:

document.write(
'<div id="loading1"><img src="load.gif"></div>' +
'<div id="loading2"><img src="load.gif"></div>' +
'<div id="loading3"><img src="load.gif"></div>'
);

function addLoadEvent1(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
if (oldonload) {
oldonload();
}
func();
}
}
}
That is an old method, though still quite effective. There are others
that use a mix of attachEvent and addEventListener (search the
archives[1]). A better version of the above is:
function addLoadEvent1(func) {
var oldonload = window.onload;
if (typeof oldonload == 'function') {
window.onload = function(){
oldonload();
func();
}
} else {
window.onload = func;
}
}

There is a minor issue that if used extensively, the closures that are
formed may consume more memory than you realise. However, it may not
use much more than would have been consumed using addEventListener/
attachEvent, just be aware of it.
1. The following link has a good discussion:
<URL:
http://groups.google.com.au/group/co...561d5a2ebdb4aa
>
--
Rob

May 23 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: gpbmike | last post by:
I'm wondering if anyone else has had this problem before. Every now and then a div on my page will overlap with another. Thi only happens in firefox (vs. IE and Safari) and it corrects itself whe...
33
by: LRW | last post by:
http://gto.ie-studios.net/index.php When you view the above site in IE, if the 1st of the three product images is tall enough to push the cell down a couple of pixels, IE somehow doesn't show...
1
by: littlefool | last post by:
Hi, I'm trying to access a XML file in Firefox. It works perfect in IE (with the ActiveXObject), but in Firefox displays it an empty page. I found on the web examples how to do that, but I still...
23
by: AJBopp | last post by:
Ok, I'm trying to be a good little boy and create a site that doesn't use frames :) Things were going along decently until I uploaded what little I have done so far to the web server (that is,...
3
by: 9DeT | last post by:
The javascript works perfect on IE, but on firefox it doesnt. I've pasted both frames source, as well as the page source ( the right frame source.txt was zipped to fit the maximum size allowed)...
2
by: cbjewelz | last post by:
Hey all. So I'm having problems with cross browser alignments. I'm looking at Safari and Mozilla Firefox. I develop in Safari and so it looks perfect there however in Firefox my vertical...
0
by: atarumorooka | last post by:
Hello, yes..it must be hard to try and help someone else coding but today is a full week of sadness and stress for IE CSS rendering and I need your help. Here you have a link that looks nice with...
1
by: Adam K. | last post by:
Hello, I have a site I'm working on for a customer and trying to figure out why its displaying differently in IE7 than it is in Firefox. ...
2
by: Steve | last post by:
A few months ago I went to a web site that looked terrible in Firefox, but fine in IE and Opera. It turned out that because I had reset my default font size in Firefox to be larger, that my...
1
by: marss | last post by:
On Apr 30, 3:42 pm, "Beauregard T. Shagnasty" <a.nony.m...@example.invalidwrote: For exUSSR Opera share is a little more. I do not worry about Opera prospect, I worry about the task I 've got...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.