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/node/nodename/index.html | 102 ++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 files/ja/web/api/node/nodename/index.html (limited to 'files/ja/web/api/node/nodename') diff --git a/files/ja/web/api/node/nodename/index.html b/files/ja/web/api/node/nodename/index.html new file mode 100644 index 0000000000..65daeb1074 --- /dev/null +++ b/files/ja/web/api/node/nodename/index.html @@ -0,0 +1,102 @@ +--- +title: Node.nodeName +slug: Web/API/Node/nodeName +tags: + - DOM + - Gecko + - Gecko DOM Reference +translation_of: Web/API/Node/nodeName +--- +
+ {{APIRef}}
+
+  
+
+ 概要
+

ノードの名前を文字列で返します。

+

構文

+
str = node.nodeName;
+
+ +

注記

+

以下の異なる種類のノードの戻り値があります。

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
InterfacenodeName
AttrAttr.name と同じ
CDATASection"#cdata-section"
Comment"#comment"
Document"#document"
DocumentFragment"#document-fragment"
DocumentTypeDocumentType.name と同じ
ElementElement.tagName と同じ
Entity実体名
EntityReference実体参照名
Notation記法名
ProcessingInstructionProcessingInstruction.target と同じ
Text"#text"
+

+

次のマークアップ文書が与えられているとします。

+
<div id="d1">hello world</div>
+<input type="text" id="t"/>
+
+

そして、以下のスクリプトがあると考えてください。

+
var div1 = document.getElementById("d1");
+var text_field = document.getElementById("t");
+
+text_field.value = div1.nodeName;
+
+

XHTML (あるいは、他の XML 形式) の場合 text_field の値には "div" が入ります。しかし、HTML の場合 text_field の値には "DIV" が入ります。

+

注意: tagName プロパティが使用された場合、nodeNametagName と同じ値になります。tagName が未定義 (undefined) の時 nodeName はテキストノードである #text を返します。

+

仕様

+ -- cgit v1.2.3-54-g00ecf