Saturday, 1 March 2014

Slide Show Operation using Java Script

Take Images in a folder at Project.
Ans:-

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

<!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>Slide Show..</title>
    <script type="text/JavaScript" language="JavaScript">      
    var i = 0;
        var path = new Array();
        // LIST OF IMAGES
        path[0] = "Image/1.jpg";
        path[1] = "Image/2.jpg";
        path[2] = "Image/3.jpg";
        path[3] = "Image/4.jpg";
        function swapImage() {
            document.slide.src = path[i];
            if (i < path.length - 1)
            i++;
            else i = 0;
            setTimeout("swapImage()", 3000);
        }
        window.onload = swapImage;
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <center>
    <div>Slide Show</div>
    <div>
     <img height="200" name="slide" src="Image/1.jpg" width="400" />
    </div>
    </center>
    </form>
</body>
</html>


No comments:

Post a Comment