Tuesday, 2 October 2012

How to Create image Slide show in javascript.

How to Createimage  Slide show  in javascript.

<html>
<head>
<title>image slider</title>
<script type="text/javascript">

      <!-- Here create instance of the image  -->
     <!-- If you want to use 10 image create 10 instance of image..-->
      var img1=new Image();
     img1.src="your image path" ;<!-- Here give the path for image...in each instance -->
var img2=new Image();
     img2.src="your image path" ;
      var img3=new Image();
img3.src="your image path" ;
</script>
<script type="text/javascript">
 var step=1;
function slider()
{
    

  document.images.slide.src=eval("img"+step+".src");
  if(step<3)
{
  step++;
 }
  else
  {
    step=1;
  }
    setTimeout("slider()",2100);
}
</script>
    
</head>
<body  onload="slider()">
<!-- here onload of the page function will call -->

<img src=" image src"slide" height="200" width="200" />
<!--put all the images which is use in the slider in one  folder then  give proprer src of the image, any one image src give above,.... ..  -->
</body >


</html>



I hope you will do this....



No comments:

Post a Comment