Monday, 25 August 2014

auto pic change


<head>

<script type="text/javascript">
var c=0;

function photoGallery()
{
if (c==1)
{

document.getElementById('photo-gallery').src = "1.jpg";
document.getElementById('check').innerHTML="2.jpg";

}
if (c==2){

document.getElementById('photo-gallery').src = "2.jpg";
document.getElementById('check').innerHTML="3.jpg";

}
if (c==3){

document.getElementById('photo-gallery').src = "3.jpg";
document.getElementById('check').innerHTML="4.jpg";

}


if(c>=3)
{
c=0;
}

c++;
setTimeout("photoGallery()",3000)
}

</script>

</head>
<body onLoad="photoGallery()">
<table border="1" align="center">
<tr>
<td><img src="images/1.jpg" id="photo-gallery" width="420" height="260" border="5"></td>
</tr>
<tr>
<td><h1 align="center" id="check">02.jpg</h1></td>
</tr>

</table>

</body>
</html>

No comments:

Post a Comment