Running javascript function after page renders in firefox?

C

cjl

Hey all:

I am preloading a large number of images for my web application, and I
want to display something indicating progress. So I am simply swapping
the visibility of an animated gif (which shows "Loading...") off after
the images are all loaded.

I am calling my preload function using:

<body onload="preload();>

This does not work. The images get preloaded, but the page does not
render at all until the images are preloaded.

What do I need to do so that the html of the page renders immediately
while the preload script is running?

My users will be required to use firefox in full-page mode, using the
autohide extension.

-cjl
 
M

Martin Honnen

cjl wrote:

I am calling my preload function using:

<body onload="preload();>

This does not work. The images get preloaded, but the page does not
render at all until the images are preloaded.

That sounds very odd and I do not really believe that that is happening,
unless it has something to do with that extension you mention later.
Can you post a URL and tell us which version of Firefox you are
experiencing the problem with?
 
C

cjl

Martin:
That sounds very odd and I do not really believe that that is happening

Oh, it's happening. If I remove the onload call from the body tag, the
page loads and renders instantly. If I replace the onload call the
page will not render immediately, until all the images are preloaded.
unless it has something to do with that extension you mention later.

It happens with or without the extension.
Can you post a URL and tell us which version of Firefox you are
experiencing the problem with?

Firefox 1.0.4 for windows XP. I haven't been able to test it yet in
IE, due to some cross browser javscript incompatibilities I haven't
ironed out yet. I get the same problem with Mozilla.

Besides the images that are being preloaded, this page is super light
weight, only a few k of html and css. Without the preload function
onload, it renders instantly.

No URL, I don't have this stuff hosted yet. I'm working on that.

-CJL
 
M

Martin Honnen

cjl said:
If I remove the onload call from the body tag, the
page loads and renders instantly. If I replace the onload call the
page will not render immediately, until all the images are preloaded.

Very odd. Are those images on a different server than the HTML document?
Is there anything else (Flash or another plugin) on the page that needs
to load resources?
Post the URL when you have the stuff up on a public server.
 
C

cjl

Martin:

I stand corrected. Now that I have posted this to an actual web server
it no longer exhibits the improper behaviour. Oddly, this problem
(still) only occurs if I open the page locally.

My apologies to Martin, who didn't believe me, and was right not to.
You, sir, are a gentleman and a scholar.

Warning: Horrible HTML / CSS / Javascript ahead:
http://www.saintrays.net

Before mocking my design choices and coding abilities, keep in mind
that I am a doctor (radiologist) and not a programmer or designer. This
web app will be targeted to a very small group of people, and I will
require that they must view it in 'fullscreen' 1024 x 768 for it to
render correctly, hopefully in Firefox / Mozilla until I iron out the
IE bugs. It will be a sort of 'teaching file' of interesting cases
when finished. The fullscreen look is so that it can mimic the look of
powerpoint, without actually being as limiting as powerpoint. To see
what I mean, click on the "CR" button to load the plain film images,
and double click on an image. This zooms it. When zoomed, you can click
and drag to pan. Double clicking again zooms out. All of this is
impossible with powerpoint. Of course, a lot of functionality has yet
to be implemented.

Anyway, thanks again. Now to clean up the code, and add some actual
error checking to my functions.

-CJL
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,740
Latest member
JudsonFrie

Latest Threads

Top