锘?function () { function $(param) { if (arguments[1] == true) { return document.querySelectorAll(param); } else { return document.querySelector(param); } } var $box = $(".slider1"); var $box1 = $(".slider1 ul li",true); var $length = $box1.length; var current = 0; var timer; timer = setInterval(go,2000); function go(){ for(var j =0;j<$length;j++){ $box1[j].style.display = "none"; } if($length == current){ current = 0; } $box1[current].style.display = "block"; current++; } for(var k=0;k<$length;k++){ $box1[k].onmouseover = function(){ clearInterval(timer); } $box1[k].onmouseout = function(){ timer = setInterval(go,2000); } } function back(){ for(var j =0;j<$length;j++){ $box1[j].style.display = "none"; } if(current == 0){ current = $length; } $box1[current-1].style.display = "block"; current--; } })()