in javascript ajax image loading

Discussion in 'JavaScript' started by srikanthever4u, Jan 18, 2010.

  1. #1
    Hello All,
    in java script how to use Ajax image loading processing..

    Cheers
     
    srikanthever4u, Jan 18, 2010 IP
  2. s_ruben

    s_ruben Active Member

    Messages:
    735
    Likes Received:
    26
    Best Answers:
    1
    Trophy Points:
    78
    #2
    I think ajax is not important for it. It can be done by JavaScript.

    Example:

    
    <html>
    
    <head>
      <title>Loading image</title>
    </head>
    
    <body>
    
    <img id="loading_image" src="http://forums.digitalpoint.com/images/misc/dps_logo.gif">
    <div id="loading">Loading...</div>
    
    </body>
    
    <script>
        document.getElementById('loading_image').style.display = "none";
        document.getElementById('loading').style.display = "";
        document.getElementById('loading_image').onload = function(){
            document.getElementById('loading').style.display = "none";
            document.getElementById('loading_image').style.display = "";
        }
    </script>
    
    </html>
    
    Code (markup):
     
    s_ruben, Jan 18, 2010 IP