Image Slider using Java Script


 In this article, I am showing the image slider using java script.through this we can mange image speed also.

Source Code:-

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="SlideShowImages.aspx.cs"
    Inherits="SlideShowImages" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript">


        var slideimg = new Array()

        function sliderimages() {

            for (i = 0; i < sliderimages.arguments.length; i++) {

                slideimg[i] = new Image()

                slideimg[i].src = sliderimages.arguments[i]

            }

        }

    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <img src="img/IMG1.jpg" alt="Slideshow Image Script"
            name="slide" border="0" style="height: 336px; width: 298px" />
        <script type="text/javascript">

                   sliderimages("img/IMG1.jpg","img/IMG2.jpg","img/IMG3.jpg", "img/IMG4.jpg","img/IMG5.jpg","img/IMG6.jpg")
                   var sliderspeed = 2000
                   var whichimage = 0
                   function slideit() {
                       if (!document.images)
                           return
                       document.images.slide.src = slideimg[whichimage].src
                       if (whichimage < slideimg.length - 1)
                           whichimage++
                       else
                           whichimage = 0
                       setTimeout("slideit()", sliderspeed)

                   }
                   slideit()
        </script>
    </div>
    </form>
</body>
</html>


Out Put:-



Image Slider using Java Script Image Slider using Java Script Reviewed by NEERAJ SRIVASTAVA on 9:15:00 PM Rating: 5

No comments:

Powered by Blogger.