image src changes during a form submittal

E

e

IE6. I have a form that can take a while to process once the user submits
it. So upon submittal of the form, the onclick event for the submit button
changes some text on the screen to say 'please wait', and also displays a
little cycling-animated gif (just to encourage the notion that the webpage
is 'doing something'). The problem is that sometimes only the placeholder
for the image shows up, and sometimes the image shows up; it's more or less
a gamble each time whether or not the image will fully load. Here's what
I'm doing, in a nutshell:

When the page is initially loaded, I 'preload' the image by creating a new
image object in js:

var pleaseWait = new Image(100, 13);
pleaseWait.src = '/images/pleasewait.gif';

On the page, there is an img tag that has no src attribute and a
style.visibility of hidden. It's laying in wait for the submit button to be
clicked so it can display the image when it's time:

<img id=animImg width=0 height=0 style="visibility: hidden;" border=0>

And in the submit onclick handler, this happens:

animImg.src = pleaseWait.src;
animImg.style.visibility = 'visible';
animImg.width = pleaseWait.width;
animImg.height = pleaseWait.height;

Sometimes the image shows up, and sometimes it doesn't. I've swapped around
the order in which animImg's properties are modified, but to no avail. Is
there a way to do this so that the image reliably loads fully every time the
submit button is clicked? Any force-the-image-to-display methods, special
order I should be doing this in, etc?
 
B

Bill M.

I've had that happen before with simple image loading and no script. I can't
remember exactly what I did, but after fiddeling with Apache the problem has
gone away. Maybe that's a clue?

Sorry I can't offer more.


Bill
 
F

Fabian

e hu kiteb:

<img id=animImg width=0 height=0 style="visibility: hidden;" border=0>
Sometimes the image shows up, and sometimes it doesn't. I've swapped
around the order in which animImg's properties are modified, but to
no avail. Is there a way to do this so that the image reliably loads
fully every time the submit button is clicked? Any
force-the-image-to-display methods, special order I should be doing
this in, etc?

istm that having both no SRC attribute and having the visibility
attribute set to idden is a belt and braces appraoch. Have you tried
just using one of these? Id try setting the SRC to the normal image, and
just leaving the visibility to be hidden.
 

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,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top