关于div隐藏 当用户不操作界面(移动和pc),自动隐藏div无限循坏不要只能执行一次刚刚进入界面下图,但是用户不操作界面时候,设置时间自动隐藏上图div,变成就是怎么去判断用户操作界面时候,不隐藏div图一div,用户不操作界面时候变成图二 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <!doctype html><html lang="en"><head> <meta charset="UTF-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> <title> 页面名称 </title><style type="text/css">#div1 { width: 300px; height: 500px; background-color: #099;}#div2 { width: 30px; height: 500px; background-color: #666; display: none;}</style></head><body><div id="div1"></div><div id="div2"></div><script type="text/javascript">var timer;function hideDiv() { clearTimeout(timer); timer = setTimeout(function(){ document.getElementById("div1").style.display = "none"; document.getElementById("div2").style.display = "block"; }, 5000);}document.getElementById("div2").onclick = function(){ document.getElementById("div2").style.display = "none"; document.getElementById("div1").style.display = "block";}document.addEventListener("touchstart",hideDiv);document.addEventListener("mousedown",hideDiv);document.addEventListener("keydown",hideDiv);hideDiv();</script></body></html> SVG中嵌入JavaScript 请问discuz的论坛程序在发表话题的时候上传附件的功能是怎么实现的? [前辈]页面html与js分离,一直在线等大家! javascript 事件问题 谁做过taobao用户注册的那个验证程序? Ext.data.Store的reader为啥读不出数据 [自定回调函数]如何在setTimeout函数外做timeout之后的回调函数? 字符如何日期对象?????????????????? 哪位大侠能详细介绍一下document.selection? 控制表格问题 基于scorm的LMS管理系统 uploadify插件加载不出来,提示错误,怎么处理
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title> 页面名称 </title>
<style type="text/css">
#div1 {
width: 300px;
height: 500px;
background-color: #099;
}
#div2 {
width: 30px;
height: 500px;
background-color: #666;
display: none;
}
</style>
</head>
<body>
<div id="div1"></div>
<div id="div2"></div>
<script type="text/javascript">
var timer;
function hideDiv() {
clearTimeout(timer);
timer = setTimeout(function(){
document.getElementById("div1").style.display = "none";
document.getElementById("div2").style.display = "block";
}, 5000);
}document.getElementById("div2").onclick = function(){
document.getElementById("div2").style.display = "none";
document.getElementById("div1").style.display = "block";
}document.addEventListener("touchstart",hideDiv);
document.addEventListener("mousedown",hideDiv);
document.addEventListener("keydown",hideDiv);
hideDiv();
</script>
</body>
</html>