Ramdas Add

Friday, 10 February 2012

How to make image slide show from javascript in asp.net

How to make image slide show from javascript in asp.net


This asp.net article used for making slide show from JavaScript like flash file (.swf file)
there is no need to be flash installation on client browser.

Just Add Your Image In Picture Array
And Add Fuction to body onload.




   <script type="text/javascript">
       // Set the slideshow speed (in milliseconds)
       var SlideShowSpeed = 5000;

       // Set the duration of crossfade (in seconds)

       var CrossFadeDuration = 2;
       var Picture = new Array(); // don't change this
http://www.assoc-amazon.com/e/ir?t=widgetsamazon-20&l=btl&camp=213689&creative=392969&o=1&a=B003A9FFKI

      //***Add Your Image Here To Make Slide Show)**
       Picture[1] = 'Image/laptop1';
       Picture[2] = 'Image/laptop2';
       Picture[3] = 'Image/laptop3';
       Picture[4] = 'Image/laptop2;
       Picture[5] = 'Image/laptop5';
       Picture[6] = 'Image/laptop6';
       Picture[7] = 'Image/laptop7';


       var tss;
       var iss;
       var jss = pickRandom(Picture.length - 1);
       var pss = Picture.length - 1;
       //alert(jss);

       var preLoad = new Array();
       for (iss = 1; iss < pss + 1; iss++) {
           preLoad[iss] = new Image();
           preLoad[iss].src = Picture[iss];
       }
       function runSlideShow() {
           if (document.all) {
               document.images.LogoBox.style.filter = "blendTrans(duration=2)";
               document.images.LogoBox.style.filter = "blendTrans(duration=CrossFadeDuration)";
               document.images.LogoBox.filters.blendTrans.Apply();
           }
           document.images.LogoBox.src = preLoad[jss].src;
           //if (document.getElementById) document.getElementById("CaptionBox").innerHTML= Caption[jss];
           if (document.all) document.images.LogoBox.filters.blendTrans.Play();
           jss = jss + 1;
           if (jss > (pss)) jss = 1;
           tss = setTimeout('runSlideShow()', SlideShowSpeed);
       }
       function pickRandom(range) {
           if (Math.random)
               return (Math.round(Math.random() * range) + 1);
           else {
               return 1;
           }
       }
 
</script>





 
    <img border="0" name="LogoBox" src="design/space.gif" width="140" />







OutPut Of Code</div>

No comments:

Post a Comment