<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>无标题文档</title> <style type="text/css"> .box{ 500px; height:500px; margin:0 auto; } .box .div{ 500px; height:500px; float:left; display:none; } .box .div:nth-of-type(1){ background:red; display:block; } .box .div:nth-of-type(2){ background:blue; } .box .div:nth-of-type(3){ background:green; } </style> </head> <body> <div class="box"> <p class="div"></p> <p class="div"></p> <p class="div"></p> </div> </body> <script type="text/javascript" src="故障页/js/jquery.min.js"></script> <script type="text/javascript"> $(function(){ var index =0; //3秒轮播一次 setInterval(function(){ index = (index == 2) ? 0 : index + 1; //某个div显示,其他的隐藏 $(".div").hide().eq(index).show(); }, 3000); }) </script> </html>