日期:2014-05-17 浏览次数:20633 次
<html> <head> <script> var aaa=['1.png','2.png','3.png']; var count = 0; function on_load(){ document.body.style.background="url("+aaa[count]+")"; if (++count == aaa.length) { count = 0; } } setInterval("on_load()",1000); </script> </head> <body> </body> <html>
------解决方案--------------------
document.body.style.background="url("+aaa[count]+")";
改成
document.getElementById("div的id").style.background="url("+aaa[count]+")";