div显示和隐藏

时间:2023-03-08 23:20:44
div显示和隐藏

它是实现比较简单.style.display控制层隐藏或显示属性.

<html>
<body>
<script>
function show(){
document.getElementById("div").style.display="";
//alert(document.getElementById("div").style.display)
}
function hidden(){
document.getElementById("div").style.display="none";
//alert(document.getElementById("div").style.display)
}
</script>
<BODY>
<input name="name" type="button" onClick="show();" value="显示">
<div id="div" style="display: none" onMouseout="hidden();">
show it
</div>
</body>
</html>

版权声明:本文博客原创文章。博客,未经同意,不得转载。