HTML DOM display 属性
2016-04-26 17:55
344 查看
http://www.jb51.net/w3school/htmldom/prop_style_display.htm
}
</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>[/code]
HTML DOM Style 对象参考手册
定义和用法
display 属性设置元素如何显示。语法:
Object.style.display=value
Possible Values
值 | 描述 |
---|---|
none | 此元素不会被显示。 |
block | 此元素将显示为块级元素,此元素前后会带有换行符。 |
inline | 默认。此元素会被显示为内联元素,元素前后没有换行符。 |
list-item | 此元素会作为列表显示。 |
run-in | 此元素会根据上下文作为块级元素或内联元素显示。 |
compact | 此元素会根据上下文作为块级元素或内联元素显示。 |
marker | |
table | 此元素会作为块级表格来显示(类似 <table>),表格前后带有换行符。 |
inline-table | 此元素会作为内联表格来显示(类似 <table>),表格前后没有换行符。 |
table-row-group | 此元素会作为一个或多个行的分组来显示(类似 <tbody>)。 |
table-header-group | 此元素会作为一个或多个行的分组来显示(类似 <thead>)。 |
table-footer-group | 此元素会作为一个或多个行的分组来显示(类似 <tfoot>)。 |
table-row | 此元素会作为一个表格行显示(类似 <tr>)。 |
table-column-group | 此元素会作为一个或多个列的分组来显示(类似 <colgroup>)。 |
table-column | 此元素会作为一个单元格列显示(类似 <col>) |
table-cell | 此元素会作为一个表格单元格显示(类似 <td> 和 <th>) |
table-caption | 此元素会作为一个表格标题显示(类似 <caption>) |
实例
本例设置不显示元素:<html> <head> <script type="text/javascript"> function removeElement() { [code]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>[/code]
TIY
display - 设置不显示元素HTML DOM Style 对象参考手册
相关文章推荐
- HTML——2(HTML 文件的结构)
- HTML——1(HTML 5 文件的基本语法)
- html中input元素的input事件对iphone原生中文输入法下的兼容问题
- html仿今日头条数据列表
- HTML DOM学习笔记
- HTML 5.1来了 9月份正式发布 更新内容预览
- PDF表单域(FormField)在HTML显示与提交数据到服务器
- servlet get post with html
- 在html中嵌入多媒体文件
- HTML--绝对路径, 表格,表单, 框架
- html获取自定义属性值
- HTML DOM 事件
- 关于 a标签
- HTML DOM 用法
- <html>文本格式化、引用、引用和术语定义
- <html>p和br
- <html>h1~h6、body、br
- HTML 事件处理
- HTML优化技巧
- HTML <map> 设置图热点