<!DOCTYPE?HTML>
<html>
<head>
<meta?http-equiv="Content-Type"?content="text/html;?charset=utf-8">
<title>無(wú)標(biāo)題文檔</title>
<script>
????window.onload?=?function?()?{
????????var?oImg?=?document.getElementById('img1');
????????var?arr?=?['img/1.jpg',?'img/2.jpg',?'img/3.jpg',?'img/4.jpg'];
????????var?num?=?0;
????????oImg.onclick?=?function?()?{
????????????//?num?=?num?+?2;
????????????//?num?+=?2;
????????????num++;
????????????if?(num?==?arr.length)?{
????????????????num?=?0;
????????????}
????????????//?alert(?arr[num]?);
????????????oImg.src?=?arr[num];
????????};
????};
</script>
</head>
<body>
<img?id="img1"?src="img/1.jpg"?width="400"?height="400"?/>
</body>
</html>
誰(shuí)講講這個(gè)圖片切換效果流程沒看懂源代碼
幻滅丶
2016-06-13 10:34:01