Control image load process : Image Load « Ajax Layer « JavaScript DHTML






Control image load process


http://dynapi.sourceforge.net/
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
<html>
<head>
<title>DynAPI - Image Loader</title>
<script language="JavaScript" src="./dynapisrc/dynapi.js"></script>
<script language="Javascript">
  dynapi.library.setPath('./dynapisrc/');
  dynapi.library.include('dynapi.api');
  dynapi.library.include('dynapi.library');
  dynapi.library.include('dynapi.functions.Image');
</script>
<script language="Javascript">

  var myLyr;

  myLyr=dynapi.document.addChild(new DynLayer(null,100,100,300,25,'silver'));
  myLyr.addChild(new DynLayer(null,0,0,0,25,'blue'),'lyrBar');
  dynapi.document.addChild(new DynLayer("Image Progress:",100,70));

  dynapi.functions.getImage("./dynapiexamples/images/arrowdown.gif",9,5)
  dynapi.functions.getImage("./dynapiexamples/images/arrowleft.gif",5,9)
  dynapi.functions.getImage("./dynapiexamples/images/arrowright.gif",5,9)
  dynapi.functions.getImage("./dynapiexamples/images/arrowup.gif",9,5)
  dynapi.functions.getImage("./dynapiexamples/images/btn_delete.gif",25,22)
  dynapi.functions.getImage("./dynapiexamples/images/btn_first.gif",25,22)
  dynapi.functions.getImage("./dynapiexamples/images/btn_last.gif",25,22)
  dynapi.functions.getImage("./dynapiexamples/images/btn_new.gif",25,22)
  dynapi.functions.getImage("./dynapiexamples/images/btn_next.gif",25,22)
  dynapi.functions.getImage("./dynapiexamples/images/btn_prev.gif",25,22)
  dynapi.functions.getImage("./dynapiexamples/images/btn_save.gif",25,22)
  dynapi.functions.getImage("./dynapiexamples/images/btn_undo.gif",25,22)
  dynapi.functions.getImage("./dynapiexamples/images/calc.gif",32,32)
  dynapi.functions.getImage("./dynapiexamples/images/downsrc.gif",95,15)
  dynapi.functions.getImage("./dynapiexamples/images/eicon1.gif",32,32)
  dynapi.functions.getImage("./dynapiexamples/images/eicon2.gif",32,32)
  dynapi.functions.getImage("./dynapiexamples/images/eicon3.gif",32,32)
  dynapi.functions.getImage("./dynapiexamples/images/left.gif",20,22)
  dynapi.functions.getImage("./dynapiexamples/images/oversrc.gif",95,15)
  dynapi.functions.getImage("./dynapiexamples/images/pixel.gif",1,1)
  dynapi.functions.getImage("./dynapiexamples/images/src.gif",95,15)

  dynapi.functions.captureImageProgress(fn)
  dynapi.functions.setImageTTL(15000)

  function fn(c,f,t){
    var p=parseInt(((c+f)==0)? 0:((c+f)/t)*100);
    myLyr.lyrBar.setWidth(p*3)
    myLyr.lyrBar.setHTML('<font color="white">&nbsp;'+p+'%</font>')
    if((c+f)==t) {
      var a=dynapi.functions.getFailedImages();
      for(var i=0;i<a.length;i++){
        a[i].reload();
      }
    }
  }
</script>
</head>
<body>
</body>
</html>

           
       








dynapi.zip( 791 k)

Related examples in the same category