Latest web development tutorials

HTML DOM tr chOff property

tr Object Reference tr objects

Definition and Usage

chOff property sets or returns the offset in the row of the cell alignment character.

chOff property to set the number of characters of content through attribute / ch attribute characters.

grammar

Setting chOff properties:

trObject.chOff="px|%"

Back chOff properties:

trObject.chOff

Tip: chOff property has no default value.

描述
px 定义水平像素偏移
% 定义对象宽度的%的水平偏移量。


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support chOff property, but no major browsers implement this function.


Examples

Examples

"Savings" from the right column alignment of two characters:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<script>
function displayResult(){
    var c=document.getElementById("myCol");
    alert("ch属性的水平偏移为: " + c.chOff);
}
</script>
</head>
<body>

<table border="1">
    <colgroup>
        <col>
        <col id="myCol" align="char" char="." charoff="2">
    </colgroup>
    <tr>
        <th>月份</th>
        <th>存款</th>
    </tr>
    <tr>
        <td>January</td>
        <td>$100.00</td>
    </tr>
    <tr>
        <td>February</td>
        <td>$10.00</td>
    </tr>
</table>
<br>
<button type="button" onclick="displayResult()">字符对齐的水平偏移</button>
<p><b>注意:</b>不是所有主流浏览器都支持choff属性的功能。</p>

</body>
</html>

try it"


tr Object Reference tr objects