开发者

IE never stops loading image

开发者 https://www.devze.com 2023-02-17 17:40 出处:网络
I have a page that creates a static google map based on data retrieved from a database using PHP and displays it using a javascript function that is embedded inline within the code.

I have a page that creates a static google map based on data retrieved from a database using PHP and displays it using a javascript function that is embedded inline within the code.

The javascript function is automatically executed when the page loads or refreshes and also will execute when the user explicitly requests a map (onclick) to be displayed.

It works exactly how I expect on FF.

On IE8 it also works exactly as I expect, up to a point. The problem is it never seems to return from loading the image although the image is, in fact, fully displayed on the screen with all the map locations. The real problem is there are other javascript functions on the page that never get called because of the infinite load operation.

If during this prolonged loading process the user explicitly displays a map it will display correctly AND the subsequent javascript code also executes, effectively resetting the display.

BTY, if I put an alert just after the return from the javascript function it triggers but the next function, that needs to load an image never loads its image.

I know I am probably looking for trouble mixing PHP and javascript but I have tried to be real careful to respect the client/server relationship and make sure that everything on the server (php) is finished before the page containing the javascript is actually loaded.

Unfortunately, the application doesn't lend itself to creating a simple demo to reproduce it and I'm working under an NDA so I can'开发者_开发问答t point you to the page.

Any thoughts or debug suggestions would be welcome.


I don't know if this is THE answer but I have a work a round.

In the javascript I thought I was doing the right thing by destroying any existing image and creating a new image with:

image = document.createElement ('img');

If I remove this code and assign the new image to the existing image object, overwriting the src attribute, everything works for both FF and IE.

Does IE fully support document.createElement ('img')?

The thing I don't get is that the code works fine when the user explicitly selects the function so I know that IE supports createElement in some situations but it's not clear why it doesn't work all the time.

My function now works in both IE and FF.

0

精彩评论

暂无评论...
验证码 换一张
取 消