首页
极刻
圈子
教程
开源
登录 / 注册
返回教程:Javascript 参考手册
TRY RUN / 在线示例
Javascript 参考手册 尝试一下
Javascript 参考手册 尝试一下
源代码
运行
<!DOCTYPE html> <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>
运行结果