编辑下面的代码:【加编码】
<html> <head> <script> function demoDisplay() { document.getElementById("p1").style.display="none"; } function demoVisibility() { document.getElementById("p2").style.visibility="hidden"; } </script> </head> <body> <p id="p1">This is some text.</p> <p id="p2">This is some text.</p> <input type="button" onclick="demoDisplay()" value="Hide text with display property"> <input type="button" onclick="demoVisibility()" value="Hide text with visibility property"> </body> </html>
结果: 【此窗口】 帮助?
Try it Yourself - © 自强学堂