第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

index = (index+1)%imageArr.length;這句代碼什么意思?還有有沒有

index = (index+1)%imageArr.length;這句代碼什么意思?還有有沒有

慕村2502594 2018-12-31 19:45:46
<input type="text" id="imgUrl" value=""> <br> <input type="button" value="播放" onclick="autoPlay()"> <input type="button" value="添加圖片" onclick="addImage()"><br> <img src="" alt=""? height="400px" width="400px" id="img"><br> <script> var imageArr = ['http://eduppp.cn/images/0/1.jpg','http://eduppp.cn/images/0/2.jpg', 'http://eduppp.cn/images/0/3.jpg','http://eduppp.cn/images/0/4.jpg']; var index=0; function autoPlay(){ var imgObj=document.getElementById('img'); //imgObj.style.display='inline'; if(imageArr.length<=0){ imgObj.alt = '圖片木有了,請?zhí)砑?; } else{ index = (index+1)%imageArr.length;//變量值隨數(shù)組長度變化而變化 imgObj.src = imageArr[index]; ? ? ?} setTimeout(autoPlay,2000) //console.log(imageArr[index]) }index = (index+1)%imageArr.length;這句代碼什么意思?還有有沒有可替代的方案實(shí)現(xiàn)這種效果,for循環(huán)為什么就不行?
查看完整描述

1 回答

?
pardon110

TA貢獻(xiàn)1038條經(jīng)驗 獲得超227個贊

獲取圖片數(shù)組的索引

查看完整回答
反對 回復(fù) 2019-01-01
  • 1 回答
  • 0 關(guān)注
  • 1271 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號