码迷,mamicode.com
首页 > 其他好文 > 详细

Day3-----delayPrompt

时间:2014-11-22 14:36:59      阅读:156      评论:0      收藏:0      [点我收藏+]

标签:style   io   ar   使用   java   on   div   art   cti   

//------------------使用延时定时器完成提示框的延迟消失

<html>
<head><title>delayPrompt</title></head>
<style type="text/css">
#box{width: 500px;height: 500px;margin: 30px auto;background: pink;text-align: center;}
#prompt{width: 150px;height: 100px;margin: 10px;background: gray;float: left;visibility: hidden;}
#nav{float: left;width: 150px;height: 300px;background: #CC3;margin: 10px}
</style>
<script type="text/javascript">
window.onload=function(){
oPrompt=document.getElementById(‘prompt‘);
oNav=document.getElementById(‘nav‘);
var timer;
oNav.onmouseover=oPrompt.onmouseover=function(){
oPrompt.style.visibility="visible";
clearTimeout(timer);
}
oNav.onmouseout=oPrompt.onmouseout=function(){
timer=setTimeout(function(){oPrompt.style.visibility="hidden"},500);
}
}
</script>
<body>
<div id="box">
<div id="prompt">This is the delayPromptBox.</div>
<div id="nav">Show Box.</div>
</div>
</body>
</html>

Day3-----delayPrompt

标签:style   io   ar   使用   java   on   div   art   cti   

原文地址:http://www.cnblogs.com/fleshy/p/4115048.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!