tr chOff 属性

tr 对象参考手册 tr 对象

定义和用法

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

chOff 属性可通过 attribute/ch 属性字符设置内容字符的数量。

语法

设置 chOff 属性:

trObject.chOff="px|%"

返回 chOff 属性:

trObject.chOff

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

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


浏览器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

所有主流浏览器都支持 chOff 属性,但是,没有任何主流浏览器实现该功能。


实例

实例

"Savings"列从右侧对齐两个字符:

<html>
<head>
<script>
function displayResult()
{
var c=document.getElementById("myCol");
alert("The horizontal offset of the ch property is: " + c.chOff);
}
</script>
</head>
<body>

<table border="1">
  <colgroup>
    <col>
    <col id="myCol" align="char" char="." charoff="2">
  </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 horizontal offset of the alignment character</button>

</body>
</html> 

尝试一下 »


tr 对象参考手册 tr 对象