看板 Ajax 關於我們 聯絡資訊
※ 引述《piao07 ()》之銘言: : 我想寫一個功能 : 假如一共有五張圖片 : 當滑鼠移到圖片一再放開以後 會依序顯示下一張圖片 : 如果顯示到最後一張圖片 又會自動回到第一張 圖片編號: 1 2 3 4 5 <html><head><title></title> <script type="text/javascript"> var a=1; function mouseOut() { a=a%5+1 //註 document.getElementById("p1").src=a+".jpg" } </script> </head> <body> <img id="p1" src="1.jpg" onmouseout="mouseOut()" /> </body> </html> 如果圖片編號是: 0 1 2 3 4 註那一行改成a=(a+1)%5 如果圖片數量增加,改那個5 -- ▁ ◢ . * ▁▁ 狼出沒 . ˊ . ▅▂ ▂▅ ◢◤ 注意! . ▃▂▁ telnet://desert.twbbs.org-史克威爾版(squares)↙◆ ▇▇telnet://ntust.org-個人版(P_chippclass)↙◆ ▆▅▂ ψchippclass ▅▂▁ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 203.70.105.147 ※ 編輯: chippclass 來自: 203.70.105.147 (05/05 12:12)