我三秒后要隐藏
<!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>
编辑器加载中...
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· 单线程的Redis速度为什么快?
· 展开说说关于C#中ORM框架的用法!
· Pantheons:用 TypeScript 打造主流大模型对话的一站式集成库