Edit The Code:
See Result »
Try it Yourself - ©
w3big.com
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>本教程(w3big.com)</title> <script> function demoDisplay(){ document.getElementById("p1").style.display="none"; } function demoVisibility(){ document.getElementById("p2").style.visibility="hidden"; } </script> </head> <body> <p id="p1">这是一些文本。</p> <p id="p2">这是一些文本。</p> <input type="button" onclick="demoDisplay()" value="隐藏显示属性的文本"> <input type="button" onclick="demoVisibility()" value="具有可见性属性的隐藏文本"> </body> </html>