<!DOCTYPE HTML><html><head>? <title>隨手練習(xí)</title>? <meta charset="utf-8">? <style>? div { background:yellow;width:200px;height:300px;display:none;}? ? </style>? ??</head><body>?<input id="show" type="button" value="顯示" /><input id="hide" type="button" value="隱藏" /><div id="div1"></div>? ??<script type="text/javascript">? ? window.onload = function (){ ? var show1 = document.getElementById("show"); var hide1 = document.getElementById("hide"); var div1 = document.getElementById("div"); ? show1.onclick = function (){ ? div1.style.display = "block"; div1.style.background = "red"; }; hide1.onclick = function (){ ? ?div1.style.display = "none"; }; }; </script></body></html>
添加回答
舉報(bào)
0/150
提交
取消