diff options
| author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
|---|---|---|
| committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
| commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
| tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/ja/web/api/element/hasattributens | |
| parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
| download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip | |
initial commit
Diffstat (limited to 'files/ja/web/api/element/hasattributens')
| -rw-r--r-- | files/ja/web/api/element/hasattributens/index.html | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/files/ja/web/api/element/hasattributens/index.html b/files/ja/web/api/element/hasattributens/index.html new file mode 100644 index 0000000000..68833414be --- /dev/null +++ b/files/ja/web/api/element/hasattributens/index.html @@ -0,0 +1,44 @@ +--- +title: element.hasAttributeNS +slug: Web/API/Element/hasAttributeNS +tags: + - DOM + - Gecko + - 翻訳中 +translation_of: Web/API/Element/hasAttributeNS +--- +<p>{{ ApiRef() }}</p> + +<h3 id=".E6.A6.82.E8.A6.81" name=".E6.A6.82.E8.A6.81">概要</h3> + +<p><code>hasAttributeNS</code> は現在の要素が指定した属性を所有するか否かを示す boolean 値を返します。</p> + +<h3 id=".E6.A7.8B.E6.96.87" name=".E6.A7.8B.E6.96.87">構文</h3> + +<pre class="eval"><em>result</em> =<em>element</em>.hasAttributeNS(<em>namespace</em>,<em>localName</em>) +</pre> + +<ul> + <li><code>result</code> は <code>true</code> もしくは <code>false</code> の boolean 値です。</li> + <li><code>namespace</code> は属性の名前空間を特定する文字列です。</li> + <li><code>localName</code> は属性の名前です。</li> +</ul> + +<h3 id=".E4.BE.8B" name=".E4.BE.8B">例</h3> + +<pre>// 値をセットする前に属性が存在しているか検証します。 +var d = document.getElementById("div1"); +if (d.hasAttributeNS( + "http://www.mozilla.org/ns/specialspace/", + "special-align")) { + d.setAttribute("align", "center"); +} +</pre> + +<h3 id=".E6.B3.A8.E8.A8.98" name=".E6.B3.A8.E8.A8.98">注記</h3> + +<p>{{ DOMAttributeMethods() }}</p> + +<h3 id=".E4.BB.95.E6.A7.98" name=".E4.BB.95.E6.A7.98">仕様</h3> + +<p><a class="external" href="http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-ElHasAttrNS">DOM Level 2 Core: hasAttributeNS</a></p> |
