From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/ja/web/api/htmltablerowelement/index.html | 169 +++++++++++++++++++++ .../api/htmltablerowelement/insertcell/index.html | 61 ++++++++ .../api/htmltablerowelement/rowindex/index.html | 57 +++++++ 3 files changed, 287 insertions(+) create mode 100644 files/ja/web/api/htmltablerowelement/index.html create mode 100644 files/ja/web/api/htmltablerowelement/insertcell/index.html create mode 100644 files/ja/web/api/htmltablerowelement/rowindex/index.html (limited to 'files/ja/web/api/htmltablerowelement') diff --git a/files/ja/web/api/htmltablerowelement/index.html b/files/ja/web/api/htmltablerowelement/index.html new file mode 100644 index 0000000000..9e5d3a8c9d --- /dev/null +++ b/files/ja/web/api/htmltablerowelement/index.html @@ -0,0 +1,169 @@ +--- +title: HTMLTableRowElement +slug: Web/API/HTMLTableRowElement +tags: + - API +translation_of: Web/API/HTMLTableRowElement +--- +
{{ APIRef("HTML DOM") }}
+ +

The HTMLTableRowElement interface provides special properties and methods (beyond the {{domxref("HTMLElement")}} interface it also has available to it by inheritance) for manipulating the layout and presentation of rows in an HTML table.

+ +

Properties

+ +

Inherits properties from its parent, {{domxref("HTMLElement")}}.

+ +
+
{{domxref("HTMLTableRowElement.align")}} {{obsolete_inline}}
+
Is a {{domxref("DOMString")}} containing an enumerated value reflecting the {{htmlattrxref("align", "tr")}} attribute. It indicates the alignment of the element's contents with respect to the surrounding context. The possible values are "left", "right", and "center".
+
{{domxref("HTMLTableRowElement.bgColor")}} {{obsolete_inline}}
+
Is a {{domxref("DOMString")}} containing the background color of the cells. It reflects the obsolete {{htmlattrxref("bgColor", "tr")}} attribute.
+
{{domxref("HTMLTableRowElement.cells")}} {{readonlyInline}}
+
Returns a live {{domxref("HTMLCollection")}} containing the cells in the row. The HTMLCollection is live and is automatically updated when cells are added or removed.
+
{{domxref("HTMLTableRowElement.ch")}} {{obsolete_inline}}
+
Is a {{domxref("DOMString")}} containing one single character. This character is the one to align all the cell of a column on. It reflects the {{htmlattrxref("char", "tr")}} and default to the decimal points associated with the language, e.g. '.' for English, or ',' for French. This property was optional and was not very well supported.
+
{{domxref("HTMLTableRowElement.chOff")}} {{obsolete_inline}}
+
Is a {{domxref("DOMString")}} containing a integer indicating how many characters must be left at the right (for left-to-right scripts; or at the left for right-to-left scripts) of the character defined by HTMLTableRowElement.ch. This property was optional and was not very well supported.
+
{{domxref("HTMLTableRowElement.rowIndex")}} {{readonlyInline}}
+
Returns a long value which gives the logical position of the row within the entire table. If the row is not part of a table, returns -1.
+
{{domxref("HTMLTableRowElement.sectionRowIndex")}} {{readonlyInline}}
+
Returns a long value which gives the logical position of the row within the table section it belongs to. If the row is not part of a section, returns -1.
+
{{domxref("HTMLTableRowElement.vAlign")}} {{obsolete_inline}}
+
Is a {{domxref("DOMString")}} representing an enumerated value indicating how the content of the cell must be vertically aligned. It reflects the {{htmlattrxref("valign", "tr")}} attribute and can have one of the following values: "top", "middle", "bottom", or "baseline".
+
+ +

Methods

+ +

Inherits methods from its parent, {{domxref("HTMLElement")}}.

+ +
+
{{domxref("HTMLTableRowElement.deleteCell()")}}
+
Removes the cell at the given position in the row. If the given position is greater (or equal as it starts at zero) than the amount of cells in the row, or is smaller than 0, it raises a {{domxref("DOMException")}} with the IndexSizeError value.
+
{{domxref("HTMLTableRowElement.insertCell()")}}
+
Inserts a new cell just before the given position in the row. If the given position is not given or is -1, it appends the cell to the row. If the given position is greater (or equal as it starts at zero) than the amount of cells in the row, or is smaller than -1, it raises a {{domxref("DOMException")}} with the IndexSizeError value. Returns a reference to a HTMLTableCellElement [en-US].
+
+ +

Specifications

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('HTML WHATWG', "tabular-data.html#the-tr-element", "HTMLTableRowElement")}}{{Spec2('HTML WHATWG')}}No change from {{SpecName("HTML5 W3C")}}.
{{SpecName('HTML5 W3C', "tabular-data.html#the-tr-element", "HTMLTableRowElement")}}{{Spec2('HTML5 W3C')}}The parameter of insertCell is now optional and default to -1.
{{SpecName('DOM2 HTML', 'html.html#ID-6986576', 'HTMLTableRowElement')}}{{Spec2('DOM2 HTML')}}The cells, rowIndex, and selectionRowIndex properties are now read-only.
+ The methods insertCell and deleteCell can raise exceptions.
{{SpecName('DOM1', 'level-one-html.html#ID-6986576', 'HTMLTableRowElement')}}{{Spec2('DOM1')}}Initial definition.
+ +

Browser compatibility

+ +
{{CompatibilityTable}}
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
Basic support{{CompatVersionUnknown}}{{CompatGeckoDesktop(1.0)}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
ch and chOff{{CompatUnknown}}{{CompatNo}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}
Optional parameter for insertCell and support for the -1 value{{CompatUnknown}}{{CompatGeckoDesktop(20.0)}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FeatureAndroidFirefox Mobile (Gecko)IE PhoneOpera MobileSafari Mobile
Basic support{{CompatVersionUnknown}}{{CompatGeckoMobile(1.0)}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
ch and chOff{{CompatUnknown}}{{CompatNo}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}
Optional parameter for insertCell and support for the -1 value{{CompatUnknown}}{{CompatGeckoMobile(20.0)}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}
+
+ +

See also

+ + + +
+
 
+
diff --git a/files/ja/web/api/htmltablerowelement/insertcell/index.html b/files/ja/web/api/htmltablerowelement/insertcell/index.html new file mode 100644 index 0000000000..ed195d4a80 --- /dev/null +++ b/files/ja/web/api/htmltablerowelement/insertcell/index.html @@ -0,0 +1,61 @@ +--- +title: HTMLTableRowElement.insertCell +slug: Web/API/HTMLTableRowElement/insertCell +tags: + - DOM + - Gecko + - Gecko DOM Reference + - tableRow +translation_of: Web/API/HTMLTableRowElement/insertCell +--- +
+ {{ApiRef}}
+

概要

+

テーブル行に新規セルを挿入し、セルへの参照を返します。

+

構文

+
var cell = HTMLTableRowElement.insertCell(index);
+
+ +

+
<table>
+  <tr id="row0">
+    <td>Original cell</td>
+  </tr>
+</table>
+
+<script type="text/javascript">
+
+function addCell(tableRowID) {
+  // 引数に指定された id によりテーブル行要素への参照を取得
+  var rowRef = document.getElementById(tableRowID);
+
+  // セルインデックス 0 の箇所にセルを挿入
+  var newCell   = rowRef.insertCell(0);
+
+  // セルにテキストノードを追加
+  var newText  = document.createTextNode('New cell')
+  newCell.appendChild(newText);
+}
+
+// 対象テーブル行の id をパラメータとし、関数 addCell を実行
+addCell('row0');
+
+</script>
+
+

対象テーブルを valid な HTML とするには、tr 要素が最低でもひとつ td 要素を持っていなければなりません。

+

insertCell はテーブルにセルを直接的に挿入して新しい参照を返すものである事に注意して下さい。このメソッドを用いる場合、 予め {{domxref("document.createElement()")}} によって td 要素を生成する必要はありません。

+

ブラウザ互換性

+

Gecko 固有の注意事項

+ +

仕様書

+ diff --git a/files/ja/web/api/htmltablerowelement/rowindex/index.html b/files/ja/web/api/htmltablerowelement/rowindex/index.html new file mode 100644 index 0000000000..87d900ba04 --- /dev/null +++ b/files/ja/web/api/htmltablerowelement/rowindex/index.html @@ -0,0 +1,57 @@ +--- +title: HTMLTableRowElement.rowIndex +slug: Web/API/HTMLTableRowElement/rowIndex +tags: + - rowIndex + - table + - tr +translation_of: Web/API/HTMLTableRowElement/rowIndex +--- +

概要

+ +

このプロパティは、テーブル全体に関連して 行 (row) の 位置 (index) を {{htmlelement("thead")}} 、{{htmlelement("tbody")}} 、{{htmlelement("tfoot")}} の順序で取得します。

+ +

※Opera は前述の順序ではなく、 HTML 中の記述順で rowIndex を取得します。

+ +

+ +
<table>
+	<thead>
+		<tr>
+			<th>品目</th>
+			<th>価格</th>
+		</tr>
+	</thead>
+	<tbody>
+		<tr>
+			<td>抹茶プリン</td>
+			<td>250 円</td>
+		</tr>
+		<tr>
+			<td>カスタードプリン</td>
+			<td>200 円</td>
+		</tr>
+		<tr>
+			<td>牛乳プリン</td>
+			<td>150 円</td>
+		</tr>
+	</tbody>
+	<tfoot>
+		<tr>
+			<td>小計</td>
+			<td>600 円</td>
+		</tr>
+	</tfoot>
+</table>
+ +

rowIndex の値を表示する例を以下に示します。

+ +
var rows = document.getElementsByTagName('tr');
+
+for(var x = 0, xLength = rows.length; x < xLength; x++) {
+  alert('rowIndex=' + rows[x].rowIndex);
+}
+ +

互換性

+ +

Quirksmode.org の rowIndex browser compatibility を参照して下さい。

-- cgit v1.2.3-54-g00ecf