<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>js练习-变化的颜色</title>
<style type="text/css">
#div1{
margin: 15px auto;
margin-top: 200px;
background: orange;
200px;
height: 200px;
border-radius: 200px;
}
</style>
</head>
<body>
<div id="div1"></div>
<script>
var dd=document.getElementById('div1');
dd.onclick=houzi1;
function houzi1(){
dd.style.background='red';
// dd.onclick=houzi2;
setTimeout('houzi2()',500);
}
function houzi2(){
dd.style.background='orange';
// dd.onclick=houzi3;
setTimeout('houzi3()',500);
}
function houzi3() {
dd.style.background='blue';
// dd.onclick=houzi1;
setTimeout('houzi2()',500);
}
</script>
</body>
</html>