<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script type="text/javascript">
window.οnlοad=function(){
var img=document.getElementsByTagName("img")[0];
var index=1;
img.οnclick=function(){
index++;
if(index>4){
index=1;
}
img.src="image/ad-0"+index+".jpg";
}
}
</script>
</head>
<body>
<img src="image/ad-01.jpg" />
</body>
</html>
来源:CSDN
作者:幻之舞
链接:https://blog.csdn.net/hzw7150/article/details/81567417