HTML DOM display属性定义和用法
此属性主要用来设置元素如何显示。
语法:
Object.style.display=value
可能的值
HTML DOM display属性实例
本例设置不显示元素:
- <html>
- <head>
- <script type="text/javascript">
- function removeElement()
- {
- document.getElementById("p1").style.display="none";
- }
- </script>
- </head>
- <body>
- <h1>Hello</h1>
- <p id="p1">This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text.</p>
- <input type="button" onclick="removeElement()" value="Do not display paragraph" />
- </body>
- </html>