HTML DOM tr chOff 屬性

2018-08-04 20:41 更新

tr chOff 屬性

tr 對象參考手冊 tr 對象

定義和用法

chOff 屬性可設(shè)置或者返回在行中單元格的對齊字符的偏移量。

chOff 屬性可通過 attribute/ch 屬性字符設(shè)置內(nèi)容字符的數(shù)量。

語法

設(shè)置 chOff 屬性:

trObject.chOff="px|%"

返回 chOff 屬性:

trObject.chOff

提示: chOff 屬性沒有默認(rèn)值。

描述
px 定義水平像素偏移
% 定義對象寬度的%的水平偏移量。


瀏覽器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

所有主流瀏覽器都支持 chOff 屬性,但是,沒有任何主流瀏覽器實(shí)現(xiàn)該功能。


實(shí)例

實(shí)例

"Savings"列從右側(cè)對齊兩個字符:

<html>
<head>
<script>
function displayResult()
{
var c=document.getElementById("myCol");
alert("The horizontal offset of the ch property is: " + c.chOff);
}
</script>
</head>
<body>

<table border="1">
? <colgroup>
??? <col>
??? <col id="myCol" align="char" char="." charoff="2">
? </colgroup>
? <tr>
??? <th>Month</th>
??? <th>Savings</th>
? </tr>
? <tr>
??? <td>January</td>
??? <td>$100.00</td>
? </tr>
? <tr>
??? <td>February</td>
??? <td>$10.00</td>
? </tr>
</table>

<button type="button" onclick="displayResult()">Get horizontal offset of the alignment character</button>

</body>
</html>?

嘗試一下 ?


tr 對象參考手冊 tr 對象
以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號