[CODE]
<style>
div {
border:1px solid black;
display:block;
}
br {
line-height:3px;
}
</style>
<script>
var timer=0
function hide() {
lay1.style.display='none';
lay2.style.display='none';
lay3.style.display='none';
}
function aaa() {
if (timer%3==0) {
lay1.style.display='block';
lay2.style.display='none';
lay3.style.display='none';
}
if (timer%3==1) {
lay1.style.display='none';
lay2.style.display='block';
lay3.style.display='none';
}
if (timer%3==2) {
lay1.style.display='none';
lay2.style.display='none';
lay3.style.display='block';
}
timer++;
txt.innerText="运行了"+timer+"秒";
setTimeout("aaa()","1000")
}
</script>
<div id=lay1>这是1层</div><br>
<div id=lay2>这是2层</div><br>
<div id=lay3>这是3层</div>
<button onclick="hide();aaa()">开始循环</button><br>
<span id=txt></span>
[/CODE]