HTML DOM textDecoration 屬性
定義和用法
textDecoration 屬性對文本進(jìn)行修飾。
語法:
Object.style.textDecoration=none|underline|overline|line-through|blink
可能的值
值 | 描述 |
---|---|
none | 默認(rèn)。定義標(biāo)準(zhǔn)的文本。 |
underline | 定義文本下的一條線。 |
overline | 定義文本上的一條線。 |
line-through | 定義穿過文本下的一條線。 |
blink | 定義閃爍的文本(無法運行在 IE 和 Opera 中)。 |
實例
本例給文本設(shè)置下劃線:
<html>
<head>
<script type="text/javascript">
function setTextDecoration()
{
document.getElementById("p1").style.textDecoration="overline";
}
</script>
</head>
<body>
<p id="p1">This is an example paragraph.</p>
<input type="button" onclick="setTextDecoration()"
value="Set text-decoration" />
</body>
</html>