Table rulesプロパティ
Table オブジェクト
定義と用法
rules プロパティは、テーブルの内部境界線を設定または取得します。
構文
rules プロパティの設定:
tableObject.rules="none|groups|rows|cols|all"
rules プロパティの取得:
tableObject.rules
| 值 | 説明 |
|---|---|
| none | 内部境界なし |
| groups | 行グループと列グループの間の内部境界を表示 |
| rows | 内部の行間の境界を表示 |
| cols | 列間の内部境界を表示 |
| all | 行と列の間の内部境界を表示 |
ブラウザサポート
![]()
![]()
![]()
![]()
![]()
すべての主要ブラウザが rules プロパティをサポートしています
注意:IE9 ではこのプロパティを正しく表示できます。以前のバージョンの IE では、内部の 4 つの境界に加えて、外部の 4 つの境界も追加されます。
注意:Chrome と Safari はこのプロパティを正しく表示できます: 内部の境界線に加えて、外部の境界線にも影響します。
例
例
次の例では、テーブルに 2 種類の異なる内部境界線を設定しています:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>サンプル(example.com)</title>
<script>
function rows(){
document.getElementById('myTable').rules="rows";
}
function cols(){
document.getElementById('myTable').rules="cols";
}
</script>
</head>
<body>
<table id="myTable">
<tr>
<td>cell 1</td>
<td>cell 2</td>
</tr>
<tr>
<td>cell 3</td>
<td>cell 4</td>
</tr>
</table>
<br>
<button type="button" onclick="rows()">行の境界のみを表示</button>
<button type="button" onclick="cols()">列の境界のみを表示</button>
<p><b>注意:</b> rules プロパティは Internet Explorer 9 より前のバージョンでは正しく表示されません。</p>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>サンプル(example.com)</title>
<script>
function rows(){
document.getElementById('myTable').rules="rows";
}
function cols(){
document.getElementById('myTable').rules="cols";
}
</script>
</head>
<body>
<table id="myTable">
<tr>
<td>cell 1</td>
<td>cell 2</td>
</tr>
<tr>
<td>cell 3</td>
<td>cell 4</td>
</tr>
</table>
<br>
<button type="button" onclick="rows()">行の境界のみを表示</button>
<button type="button" onclick="cols()">列の境界のみを表示</button>
<p><b>注意:</b> rules プロパティは Internet Explorer 9 より前のバージョンでは正しく表示されません。</p>
</body>
</html>
試してみる »
Table オブジェクト その他の拡張