Latest web development tutorials

HTML DOM tr ch property

tr Object Reference tr objects

Definition and Usage

ch property sets or returns row cell alignment character.

The contents of all the cells in the same column alignment depends on the character.

grammar

Setting ch properties:

trObject.ch="text"

Returns ch attributes:

trObject.ch

Tip: ch property has no default value.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support ch attribute, however, it does not have any major browsers implement this function.


Examples

Examples

Align "Savings" column:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<script>
function displayResult(){
    var c=document.getElementById("myCol");
    alert("第二列对齐的字符是: " + c.ch);
}
</script>
</head>
<body>

<table border="1">
    <colgroup>
        <col>
        <col id="myCol" align="char" char=".">
    </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>不是所有的主流浏览器都支持char属性。</p>

</body>
</html>

try it"


tr Object Reference tr objects