求解<!doctype html><html><head><meta charset="utf-8"><title>京东轮播图代码</title></head><body><div class="slider" id="circle" style="width:790px; height:340px; overflow:hidden;"><a href="https://item.jd.com/11141344903.html#crumb-wrap" ><img src="images/zp (1).jpg" alt="" /></a><a href="http://xxbuyun.jd.com/"><img src="images/zp (2).jpg" styly="width:790px; height:340px" alt="" /></a><ul class="circle"><!--移动鼠标触发事件--><li onmouseover="lunbo(1)" id="1" >1</li><li onmouseover="lunbo(2)" id="2">2</li></ul><div class="arrow"><a href="javaScript:;" class="arrow-l" onclick="bo2()" id="bo1"></a><a href="javaScript:;" class="arrow-r" onclick="bo1()" id="bo2"></a></div></div><script> var a = 1; var t = 0; window.onload = function(){ t = setInterval("bo1()", 2000); }function lunbo(num){a = num;var btn = document.getElementById("circle").getElementsByTagName("img")[0];for (var i=1;i<3;i++) {var li = document.getElementById("circle").getElementsByTagName("li")[i-1];li.style.backgroundColor = "#3E3E3E"; if(num == i){btn.src = "img/"+i+"p.jpg";li.style.backgroundColor = "#B61B1F";}} }function bo1(){if(a==2){a = 1;}a++;lunbo(a);}function bo2(){if(a ==1){a = 2;}a--;lunbo(a);}</script></body></html>
添加回答
举报
0/150
提交
取消