ch

td/th ch 属性


定义和用法

ch 属性设置或返回单元格的对齐字符。

同一列中的所有单元格内容对齐取决于此字符。

语法

设置 ch 属性:

tdObject.ch="text"

或者

thObject.ch="text"

返回 ch 属性:

tdObject.ch

或者

thObject.ch

提示 property 属性没有默认值。


浏览器支持

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>?

© 2021 jiaocheng.bubufx.com  联系我们
ICP备案:鲁ICP备09046678号-3