延時提示框

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style>
			#a{
				
			}
		</style>
		<script>
			window.onload=function(){
				var a=document.getElementById('head');
				var dv=document.getElementById('dv');
				var timer=null;
				a.onmouseover=dv.onmousemove=function(){
					clearTimeout(timer);
					setTimeout(function(){
						dv.style.display='block';
					},300);
				}
				
				a.onmouseout=dv.onmouseout=function(){
					clearTimeout(timer);
					setTimeout(function(){
						dv.style.display='none';
					},300);
				}
			}
		</script>
	</head>
	<body>
		<div>
			<a href="###" id="head">顯示</a>
			<div id="dv" style="display: none;">hello</div>
		</div>
	</body>
</html>

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章