tr ch 属性

tr 对象参考手册 tr 对象

定义和用法

ch 属性可设置或者返回在行中单元格的对齐字符。

在同一列中的所有单元格的内容对齐依赖于该字符。

语法

设置 ch 属性:

trObject.ch="text"

返回 ch 属性:

trObject.ch

提示: ch 属性没有默认值。


浏览器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

所有主流浏览器都支持 ch 属性,然而,没有任何主流浏览器实现该功能。


实例

实例

对齐"Savings"的列:

<html>
<head>
<script>
function displayResult()
{
var c=document.getElementById("myCol");
alert("The alignment character for 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>

<button type="button" onclick="displayResult()">Get alignment character</button>

</body>
</html> 

尝试一下 »


tr 对象参考手册 tr 对象