当前位置:网站首页>JS picture switching (simple and practical)
JS picture switching (simple and practical)
2022-06-25 12:41:00 【Fall in love with*】
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<style type="text/css">
* {
margin: 0px;
padding: 0px;
}
#max {
margin: 100px auto;
width: 250px;
height: 350px;
border: 1px solid #F5DEB3;
background-color: #F5DEB3;
text-align: center;
}
div img {
margin: 15px 15px;
}
/* button{
margin-top:5px;
margin-left: 50px;
} */
</style>
</head>
<body>
<div id="max">
<h3 id="tips"></h3>
<img src="img/bear/1.jpg" id="img"><br>
<button id="previous" onclick="pre()"> Previous </button>
<button id="next" onclick="nex()"> Next </button>
</div>
<script type="text/javascript">
var a ;
var prev = document.getElementById("previous");
var next = document.getElementById("next");
var img = document.getElementsByTagName("img")[0];
var imgArr = ["img/bear/1.jpg", "img/bear/2.jpg","img/bear/3.jpg" , "img/bear/4.jpg","img/bear/5.jpg"];
var index = 0;
function pre(){
prev.onclick = function(){
index--;
if(index<0){
index=imgArr.length-1;
}
document.getElementById("img").src = imgArr[index];
// When you click the button Reset information
document.getElementById("tips").innerText = " Current "+(index+1)+" A picture ";
};
};
function nex(){
next.onclick = function(){
index++;
if(index>imgArr.length-1){
index=0;
}
document.getElementById("img").src = imgArr[index];
document.getElementById("tips").innerText = " Current "+(index+1)+" A picture ";
};
};
</script>
</body>
</html>
边栏推荐
- flutter 收到推送后自动消失问题
- Zhengzheng e-commerce source code -- Zhengzheng advertising e-commerce system development source code sharing
- Hook technology
- Disconnected: No supported authentication methods available (server sent: )
- Select randomly by weight [prefix and + dichotomy + random target]
- A commonly used statistical modeling method -- difference analysis
- PHP parsing QR code content
- Laravel task scheduling
- Go novice exploration pause
- Online blind box system development function introduction and some source code sharing
猜你喜欢

为何数据库也云原生了?

Execution order of MySQL query statements join, on and where

laravel 9

Go novice exploration road 2

ECSHOP quickly purchases goods, simplifies the shopping process, and improves the user experience through one-step shopping

Service charge and time setting code sharing involved in crmeb withdrawal process

(7) Pyqt5 tutorial -- > > window properties and basic controls (continuous update)

(6) Pyqt5--- > window jump (registration login function)

C program linking SQLSERVER database: instance failed

Penetration tool environment - installing sqli labs in centos7 environment
随机推荐
ECSHOP commodity page multi-attribute batch purchase plug-ins ECSHOP wholesale plug-ins multi-attribute order placing, multi-attribute batch purchase of commodities
Pycaret successfully resolved the problem that 'sklearn model_ selection._ Search 'import name "\u check\u param\u grid"
JS enter three integers a, B and C, and sort them from large to small (two methods)
Renrenyue -- renrenyue system development source code sharing
Idea2017 how to set not to automatically open a project at startup
Circular exercises of JS
laravel 9
Kotlin study notes
High imitation blue playing network disk file sharing to make money network disk PHP system source code
Zhangxiaobai's way of penetration (III) -- detailed explanation of SQL injection vulnerability principle (SQL Server)
Disconnected: No supported authentication methods available (server sent: )
Windows下MySQL的安装和删除
The network traceroute command is used to determine the path through which IP packets access the destination address.
(7) Pyqt5 tutorial -- > > window properties and basic controls (continuous update)
Ubuntu uninstalling PHP
Jeecgboot startup popup configuration is still incorrect
Dynamic proxy
Installation and removal of MySQL under Windows
Execution order of MySQL query statements join, on and where
MySQL and excel tables importing database data (Excel for MySQL)