tr chProperty
tr Object
Definition and Usage
The ch property can set or return the alignment character of cells in a row.
The content alignment of all cells in the same column depends on this character.
Syntax
Set the ch property:
trObject.ch="text"
Return the ch property:
trObject.ch
Tip:The ch property has no default value.
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the ch property; however, none of the major browsers implement this feature.
Example
Example
Align the "Savings" column:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Example (example.com)</title>
<script>
function displayResult(){
var c=document.getElementById("myCol");
alert("The aligned character in the second column is: " + c.ch);
}
</script>
</head>
<body>
<table border="1">
<colgroup>
<col>
<col id="myCol" align="char" char=".">
</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>
<br>
<button type="button" onclick="displayResult()">Get character alignment</button>
<p><b>Note:</b> Not all major browsers support the char property.</p>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>Example (example.com)</title>
<script>
function displayResult(){
var c=document.getElementById("myCol");
alert("The aligned character in the second column is: " + c.ch);
}
</script>
</head>
<body>
<table border="1">
<colgroup>
<col>
<col id="myCol" align="char" char=".">
</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>
<br>
<button type="button" onclick="displayResult()">Get character alignment</button>
<p><b>Note:</b> Not all major browsers support the char property.</p>
</body>
</html>
Try it Yourself »
tr Object
Other Extensions