日期:2014-05-16 浏览次数:20393 次
<html> <head> <title></title> <style> .bg1 { width:300px; height:300px; background-image:url('a.jpg'); background-position-x:-100px; background-position-y:0px; } .bg2 { width:300px; height:300px; background-image:url('a.jpg'); background-position-x:-140px; background-position-y:0px; } </style> <script> var index = 0; function f_onload(){ var vv = setInterval("next()",100); } function next(){ index ++; if(index % 2 == 0){ document.getElementById("bg").className = "bg1"; }else{ document.getElementById("bg").className = "bg2"; } } </script> </head> <body onload="f_onload();"> <div id="bg" class="bg1"> </div> </body> </html>