<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> </head> <body onload="start();" style="text-align:center;background-color:#cccccc;"> <div id="val" style="width:300px;height:300px;margin-left:auto;margin-right:auto;line-height:300px;background-color:blue;font-size:16em;color:white"></div> <input type="button" onclick="start();" value="开始"> <input type="button" onclick="stop();" value="停止"> <script> var inter function start(){ var i=0; inter = setInterval(function(){ i +=1; if(i != 12 && i != 2){ document.getElementById("val").innerHTML=i; } if(i == 17){ i = 1; } },100); } function stop(){ window.clearInterval(inter); } </script> </body> </html>