先把相应的图片路径添加到存储图片路径的数组imgArr里,之后运行代码就可以实现图片的切换了
以下是代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<!-- 设置样式 -->
<style type="text/css">
*{
margin: 0;
padding: 0;
}
#outer{
/* position: fixed; */
width: 2000px;
/* height: 1200px; */
margin: 0 auto;
/* padding: 20px; */
/* background-color: greenyellow; */
/*设置文本居中*/
text-align: center;
}
</style>
<script type="text/javascript">