随机出现一个页面

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>无标题文档</title>
<style>
#a{ display:none;width:300px;height:300px;background:#0C3}
#b{ display:none;width:300px;height:300px;background:#09C}
#c{ display:none;width:300px;height:300px;background:#C30}
#d{ display:none;width:300px;height:300px;background:#93C}
</style>
<script language="JavaScript" type="text/javascript">
window.onload=function(){
tips = new Array(4);
tips[0] =document.getElementById("a");
tips[1] =document.getElementById("b");
tips[2] =document.getElementById("c");
tips[3] =document.getElementById("d");
index = Math.floor(Math.random() * tips.length);
tips[index].style.display="block";
}
</script>
</head>
<body>
<div id="a">11111</div>
<div id="b">22222</div>
<div id="c">33333</div>
<div id="d">44444</div>
</body>
</html>

猜你喜欢

转载自www.cnblogs.com/yangwan/p/10333627.html
今日推荐