tr chプロパティ
tr オブジェクト
定義と使い方
ch プロパティは、行内のセルの整列文字を設定または返します。
同じ列内のすべてのセルの内容の整列は、この文字に依存します。
構文
ch プロパティを設定する:
trObject.ch="text"
ch プロパティを返す:
trObject.ch
ヒント:ch プロパティにはデフォルト値がありません。
ブラウザサポート
![]()
![]()
![]()
![]()
![]()
すべての主要ブラウザが ch プロパティをサポートしていますが、この機能を実装している主要ブラウザはありません。
例
例
"Savings" の列を整列:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>初心者チュートリアル(example.com)</title>
<script>
function displayResult(){
var c=document.getElementById("myCol");
alert("2列目の整列文字は: " + 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>
<html>
<head>
<meta charset="utf-8">
<title>初心者チュートリアル(example.com)</title>
<script>
function displayResult(){
var c=document.getElementById("myCol");
alert("2列目の整列文字は: " + 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>
試してみる »
tr オブジェクト
その他の拡張