日期:2014-05-17 浏览次数:20864 次
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>广告 </title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style type="text/css">
*{margin:0;padding:0;}
img{display:none;}
</style>
<script type="text/javascript">
//当前值
var curr = 1;
//下一个值
var next = 1;
function switchoverAD(){
//如果下一个值到了最大值 则回归到初始值
if(next >= 4){
next = 1;
}else{
//否则 递增
next++;
}
//获取该对象 并隐藏
document.getElementById("img" + curr).style.display = "none";
//让下一个值 显示
document.getElementById("img" + next).style.display = "block";
//如果当前值到了最大值 则回到道初始值
if(curr >= 4){
curr = 1;
}else{
//递归
curr++;
}
//计数器
window.setTimeout("switchoverAD()",1000);
}
</script>
</head>
<body onload="switchoverAD()">
<img id="img2" src="/JavaEE/img/o1.gif" />
<img id="img3" src="/JavaEE/img/o2.jpg"/>
<img id="img4" src="/JavaEE/img/o3.jpg"/>
<img id="img1" src="/JavaEE/img/o4.jpg"/>
</body>
</html>