Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Mar 2005
    Posts
    195
    Thanks
    0
    Thanked 0 Times in 0 Posts

    w to check that an array of images (backgrounds for divs) are actually loaded

    how to check that an array of images (backgrounds for divs) are actually loaded and displayed. And when the DOM is ready to execute a DOM/JS script
    Information is not knowledge,Knowledge is not wisdom,Wisdom is not truth,Truth is not beauty,Beauty is not love,Love is not music and Music is THE BEST. Frank Zappa

  • #2
    Senior Coder shyam's Avatar
    Join Date
    Jul 2005
    Posts
    1,563
    Thanks
    2
    Thanked 163 Times in 160 Posts
    can't u create temporary Image objects with the same images and check if they have loaded and then start processing...sorta like this
    Code:
    var img = new Image();
    img.onload = function() {
    	// when this is executed the image has definitely 
           // loaded and would have been applied to the bg
    }
    img.src = '...';
    if u have multiple images that need to get loaded use a global count var and increment it for each load and do ur stuff once a certain count is reached

  • #3
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    I am not very sure about the correctness of the method. Upon W3C, onload is an event which might be applied only upon window, frame and iframe objects and must be unique on the same element.

    http://www.w3.org/TR/html4/interact/....html#h-18.2.3
    Last edited by Kor; 02-13-2006 at 04:23 PM.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #4
    Senior Coder shyam's Avatar
    Join Date
    Jul 2005
    Posts
    1,563
    Thanks
    2
    Thanked 163 Times in 160 Posts
    Quote Originally Posted by Kor
    I am not very sure about the correctness of the method. Upon W3C, onload is an event which might be applied only upon window, frame and iframe objects and must be unique on the same element.

    http://www.w3.org/TR/html4/interact/....html#h-18.2.3
    entirely true


  •  

    Posting Permissions

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