www.webdeveloper.com
Results 1 to 4 of 4

Thread: [RESOLVED] Tricky Alert Situation / Image loading complete check

Threaded View

  1. #1
    Join Date
    Sep 2007
    Location
    INDIA
    Posts
    12

    resolved [RESOLVED] Tricky Alert Situation / Image loading complete check

    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;
    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.
    I need a way out.

    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.
    Last edited by archaeocodifix; 06-26-2009 at 06:07 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles