首页 > Web开发 > 详细

HTML DOM display 属性

时间:2016-03-15 00:20:34      阅读:255      评论:0      收藏:0      [点我收藏+]

定义和用法

display 属性设置元素如何显示。

语法:

Object.style.display=value

可能的值

技术分享

实例

本例设置不显示元素:

 1 <html>
 2 <head>
 3 <script type="text/javascript">
 4 function removeElement()
 5 {
 6 document.getElementById("p1").style.display="none";
 7 }
 8 </script>
 9 </head>
10 <body>
11 
12 <h1>Hello</h1>
13 
14 <p id="p1">This is some text. This is some text. This is some text.
15 This is some text. This is some text. This is some text.
16 This is some text. This is some text. This is some text.</p>
17 
18 <input type="button" onclick="removeElement()"
19 value="Do not display paragraph" />
20 
21 </body>
22 </html>

 

HTML DOM display 属性

原文:http://www.cnblogs.com/sihuiming/p/5277678.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!