A script with alert works fine. But when I comment the alert (actually I need to), the browser Mozilla 3 hangs and IE6 cease to function with an error message.
SCRIPT (With the alert. When the alert is commented, the script fails as stated above):
Code:var myImage = new Image; myImage.src = "./images/allback.jpg"; do { setTimeout('',10); } while(!myImage); var chk= false; var i=1; while(!chk) { chk= myImage.complete; alert(chk+' / '+i); i++; }; if(chk) imload= true;I need a way out.IE6 ERROR MESSAGE:
A script on this page is causing Internet Explorer to run slowly. If it continues to run, your computer may become unresponsive. Do you want to abort the script?
If 'yes' is chosen the page loads without the execution of the script. Otherwise it hangs.
P.S.: As per the above code, I need to check if an image is completely loaded or not. Any alternative suggestions are welcome. But I'd like to know why the current code fails. Thanks in advance.


Reply With Quote

Bookmarks