visibility 屬性設(shè)置元素是否可見。
Object.style.visibility=visible|hidden|collapse
值 | 描述 |
---|---|
visible | 默認(rèn)。元素框是可見的。 |
hidden | 元素框不可見,但仍然影響布局。 |
collapse | 當(dāng)在表格元素中使用時(shí),此值可刪除一行或一列,但是它不會影響表格的布局。被行或列占據(jù)的空間會留給其他內(nèi)容使用。如果此值被用在其他的元素上,會呈現(xiàn)為 "hidden"。 |
下面的例子隱藏一段文本:
<html>
<head>
<script type="text/javascript">
function changeVisibility()
{
document.getElementById("p1").style.visibility="hidden";
}
</script>
</head>
<body>
<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>
<form>
<input type="button" onclick="changeVisibility()"
value="Hide paragraph" />
</form>
</body>
</html>
如對本文有疑問,請?zhí)峤坏浇涣髡搲?,廣大熱心網(wǎng)友會為你解答!! 點(diǎn)擊進(jìn)入論壇
Powered by 365建站網(wǎng) RSS地圖 HTML地圖
copyright © 2013-2024 版權(quán)所有 鄂ICP備17013400號