您的位置:首页 > Web前端 > HTML

HTML DOM display 属性

2016-03-14 23:20 399 查看

定义和用法

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

语法:

Object.style.display=value


可能的值



实例

本例设置不显示元素:

<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>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: