<html>
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
</head>
<style>
</style>
<body>
<div>
<button onclick="prev()"> Prev </button>
<img id="slider" src="a.jpg" width="200px" height="150px"/>
<button onclick="next()"> Next </button>
</div>
<script>
var images = [ "a.jpg", "b.jpg" ];
var sayi=0;
function next(){
var slider=document.getElementById("slider");
sayi++;
if(sayi>=images.length){
sayi=0;
}
slider.src=images[sayi];
}
function prev(){
var slider=document.getElementById("slider");
sayi--;
if(sayi<0){
sayi=images.length-1;
}
slider.src= images[sayi];
}
</script>
</body>
</html>
Hiç yorum yok:
Yorum Gönder