<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>测试图片手动循环</title>
<style type="text/css">
.box{
padding-top: 50px;
overflow: hidden;
width: 500px;
height: 250px;
border:1px solid black;
position: relative;
}
.imgbox{
cursor: pointer;
position: absolute;
width: 100px;
height: 140px;
}
.imgbox:first-child{
left: 420px;
}
.imgbox:nth-child(2){
left: 300px;
}
.imgbox:nth-child(3){
left: 180px;
}
.imgbox:nth-child(4){
left: 60px;
}
.imgbox:nth-child(5){
left: -50px;
}
.imgbox img{
width: 100%;
}
</style>
</head>
<body>
<div class="box">
<div class="imgbox" onclick="clickMe(this)"><img src="img/img1.jpg"></div>
<div class="imgbox" onclick="clickMe(this)"><img src="img/img2.jpg"></div>
<div class="imgbox" onclick="clickMe(this)"><img src="img/img3.jpg"></div>
<div class="imgbox" onclick="clickMe(this)"><img src="img/img4.jpg"></div>
<div class="imgbox" onclick="clickMe(this)"><img src="img/img5.jpg"></div>
</div>
<script type="text/javascript">
function clickMe(argument) {
console.log("点我");
console.log(argument);
}
</script>
</body>
</html>
表示你的代码没有问题。。