JavaScript Slider Example

0


JS provide setInterval() to create slider,

setInteval("functionname",1000);

<!DOCTYPE html>

<html>

<head>

<title></title>

<script type="text/javascript">

setInterval(myfun,1000);

i=1;

function myfun()

{

if(i>3)

i=1

document.getElementById("img1").src = "img"+i+".jpg";

i++;

}

</script>

</head>

<body>

<img id="img1"  />

</body>

</html>

Tags

Post a Comment

0Comments

POST Answer of Questions and ASK to Doubt

Post a Comment (0)