我三秒后要隐藏

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="gb2312">
<head>
<title> New Document </title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta name="robots" content="all" />
<meta name="author" content="ZerGiNe" />
<meta name="Copyright" content="All rights reserved by ZerGiNe" />
<meta name="description" content="desc" />
<meta name="keywords" content="desc" />
<link rel="icon" href="/favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" rev="stylesheet" href="" type="text/css" media="all" />
</head>
<body>
<div id="hidden_div" >3 秒 </div>
</body>
</html>
<script>
var action;
var obj;
var timer;
function setTimer(id,time,act){
obj
= document.getElementById(id);
action
= act;
timer
= time;
setTimeout(
"doFunc(action,obj)",timer);
}
function doFunc(action,obj){
var _eventObj = obj;
switch (action){
case "hidden":
_eventObj.style.display
='none';
break;
case "show":
_eventObj.style.display
='';
break;
default:
_eventObj.style.display
='';
break;
}
}
var timeComp = new setTimer("hidden_div",3000,"hidden")
</script>
<script>
var action;
var obj;
var timer;
function setTimer(id,time,act){
obj
= document.getElementById(id);
action
= act;
timer
= time;
setTimeout(
"doFunc(action,obj)",timer);
}
function doFunc(action,obj){
var _eventObj = obj;
switch (action){
case "hidden":
_eventObj.style.display
='none';
break;
case "show":
_eventObj.style.display
='';
break;
default:
_eventObj.style.display
='';
break;
}
}
var timeComp = new setTimer("hidden_div",3000,"hidden")
</script>
<body onload="setTimer('a1',3000,'hidden');setTimer('a2',4000,'show')">
<div id="a1">等3秒。。。载入中</div>
<div id="a2" style="display: none">完成</div>
</body>
<script> 
var _st = window.setTimeout;
window.setTimeout
= function(fRef, mDelay) {
if(typeof fRef == 'function'){
var argu = Array.prototype.slice.call(arguments,2);
var f = (function(){ fRef.apply(null, argu); });
return _st(f, mDelay);
}
return _st(fRef,mDelay);
}
function func(id,dis){
document.getElementById(id).style.display
=dis;
}
</script>
<body onload="setTimeout(func,3000,'a1','none');setTimeout(func,4000,'a2','');">
<div id="a1">等3秒。。。载入中</div>
<div id="a2" style="display: none">完成</div>
</body>
<script> 
function show(id,bshow,delay){
setTimeout(
function(){
document.getElementById(id).style.display
=bshow?'':'none';
},delay);
}
</script>
<body onload="show('a1',false,300);show('a2',true,400)">
<div id="a1">等3秒。。。载入中</div>
<div id="a2" style="display: none">完成</div>
</body>
      <body onload="setTimeout('a1.style.display=\'none\'',3000);setTimeout('a2.style.display=\'\'',4000);">
<div id="a1">Loading.......</div>
<div id="a2" style="display: none">Complete !</div>
</body>






<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<div id="a1" onClick="setTimeout('a1.style.display=\'none\'',3000)">我三秒后要隐藏</div>

</body>
</html>

 

<div id="a1">我三秒后要隐藏</div>
<button onclick="hide()">点我</button>
<script>
function hide(){
setTimeout(
"a1.style.display='none'",3000);
}
</script>


编辑器加载中...

posted @ 2012-03-11 19:03  星星的学习小志  阅读(196)  评论(0编辑  收藏  举报