Skip to main content

Moving Image through javascript like flash file in asp.net

This asp.net article used for making slide show from JavaScript. Many time we need to do such task like moving images in html pages or an aspx page then we think about flash to do that task but it is must to install flash plugin in client browser,so we need an alternative solution of flash to move image just like flash, so here is the solution for making image slide solution through javascript, Just Add Your Image In Picture Array And Add Fuction to body onload.


<html>
<head>
   <script type="text/javascript">
       // Set the slideshow speed (in milliseconds)
       var SlideShowSpeed = 2000;
       // Set the duration of crossfade (in seconds)
       var CrossFadeDuration = 2;
       var Picture = new Array(); // don't change thishttp://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] = 'https://lh6.googleusercontent.com/-yxSVExWlgVU/TnGzagza8CI/AAAAAAAAAFo/7J-TtBIAeIk/h80/images2.jpeg';

       Picture[2] = 'https://lh6.googleusercontent.com/-T1gMExXTH0k/TnGzfOuwv7I/AAAAAAAAAFs/avs2xX0HItY/h80/images.jpeg';

       Picture[3] = 'https://lh4.googleusercontent.com/-ddekiHGKZZ4/TnGzfx37seI/AAAAAAAAAFw/Xrfj6llMBFc/h80/images1.jpeg';

       Picture[4] = 'https://lh3.googleusercontent.com/-12l1Dtt1jyI/TnGzgp4DZ9I/AAAAAAAAAF4/I-BPvCGbb5k/h80/images3.jpeg';

       Picture[5] = 'https://lh6.googleusercontent.com/-PDV1Qb0iVY4/TnGzhJxAIOI/AAAAAAAAAF8/XQ6Lv3cmhz4/h80/images4.jpeg';

       Picture[6] = 'https://lh4.googleusercontent.com/-tMJmD_E0E2w/TnGzhvrkbTI/AAAAAAAAAGA/_p3JslMbGLA/h80/index.jpeg';

       Picture[7] = 'https://lh5.googleusercontent.com/-rHjrWPBlsug/TnGziCXDNLI/AAAAAAAAAGE/gfhzeGX5Epc/h80/index1.jpeg';

       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>
</head>
<body onload="setTimeout('runSlideShow()', 1001);">
   <!-- Client Name of ImageControl must be 'LogoBox'-->
    <img name="LogoBox" border="0" src="design/space.gif" width="140" >
</body>
</html>


// OutPut of the following code is here:-




Popular posts from this blog

Merging multiple PDFs using iTextSharp in asp.net c#

In this article i will show you how to merge multiple pdfs into one using ITextSharp below is the two approach one is to pass your input files path, output file path (will be created if not exist) and another is pass direct input stream, output stream and it will write the merge files into output stream.

how $document.ready() is different from window.onload()

we often use window.onload() in javascript and $document.ready() in jquery and assume that both are same just jquery library wrap up javascript window.onload() and introduce $document.ready() but no there is much difference between them below is the explanation -

Uploading large file in chunks in Asp.net Mvc c# from Javascript ajax

Often we have a requirement to upload files in Asp.net, Mvc c# application but when it comes to uploading larger file, we always think how to do it as uploading large file in one go have many challenges like UI responsiveness, If network fluctuate for a moment in between then uploading task get breaks and user have to upload it again etc.

Scrollable Gridview with fixed headers in asp.net

horizontal and vertical scrollable Gridview with static header row.fixed header in gridview in asp.net.static header in gridview through java script.I was looking for a solution for this for a long time and found most of the answers are not working or not suitable for my situation i also find most of the java script code for that they worked but only with the vertical scroll not with the horizontal scroll and also combination of header and rows doesn't match.