比较简单的实现.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>
通过JavaScript控制div隐藏,显示
最新推荐文章于 2023-05-14 14:13:13 发布