1.轮播换图
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <style> img{width:170px;height: 130px;} </style> <script src="http://apps.bdimg.com/libs/jquery/1.6.4/jquery.min.js"></script> <script> $(function () { var i=0; var tt; $("img").hover(function () { clearInterval(tt); },tab()); function tab(){ tt=setInterval(function(){ i++; $("img").attr("src","img/pic"+i+".png"); if(i>2){ i=0; } },1000); } tab(); }); </script> </head> <body> <img src="img/pic1.png"/> </body> </html>
时间: 2024-10-25 21:21:29