From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../web/api/htmltableelement/insertrow/index.html | 114 +++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 files/ja/web/api/htmltableelement/insertrow/index.html (limited to 'files/ja/web/api/htmltableelement/insertrow/index.html') diff --git a/files/ja/web/api/htmltableelement/insertrow/index.html b/files/ja/web/api/htmltableelement/insertrow/index.html new file mode 100644 index 0000000000..2d0a6808be --- /dev/null +++ b/files/ja/web/api/htmltableelement/insertrow/index.html @@ -0,0 +1,114 @@ +--- +title: HTMLTableElement.insertRow +slug: Web/API/HTMLTableElement/insertRow +tags: + - DOM + - Gecko + - Gecko DOM Reference +translation_of: Web/API/HTMLTableElement/insertRow +--- +
+ {{ApiRef}}
+

概要

+

insertRow は、テーブル内に新しい行を挿入します。

+

構文

+
var row = HTMLTableElement.insertRow(index);
+ +

+
<table id="TableA">
+  <tr>
+    <td>Old top row</td>
+  </tr>
+</table>
+
+<script type="text/javascript">
+
+function addRow(tableID) {
+  // table 要素への参照を取得し、変数に代入
+  var tableRef = document.getElementById(tableID);
+
+  // テーブルのインデックス 0 の行(一行目)に行を挿入
+  var newRow   = tableRef.insertRow(0);
+
+  // 一行目にセルを挿入
+  var newCell  = newRow.insertCell(0);
+
+  // 作成したセルにテキストノードを挿入
+  var newText  = document.createTextNode('New top row')
+  newCell.appendChild(newText);
+}
+
+// 引数にテーブルの id を指定して関数 addRow() を実行
+addRow('TableA');
+
+</script>
+ +

ブラウザ実装状況

+
+ {{CompatibilityTable}}
+
+ + + + + + + + + + + + + + + + + + + +
機能ChromeFirefox (Gecko)Internet ExplorerOperaSafari
基本サポート435.510.104
+
+
+ + + + + + + + + + + + + + + + + + + +
機能AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
基本サポート{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}
+
+

Gecko 固有の注意事項

+ +

仕様書

+ -- cgit v1.2.3-54-g00ecf