Mozilla.com

  1. MDC
  2. メインページ
  3. DOM
  4. element.removeAttribute

◆◆◆ 翻訳中 ◆◆◆

このページは翻訳中です。
翻訳作業に参加する場合は、履歴にある翻訳者と連絡·調整してください。


« Gecko DOM リファレンス

概要

removeAttribute は指定の要素から属性を取り除きます。

構文

element.removeAttribute(attrName) 
  • attrNameelement から取り除く属性の名前を表す文字列です。

// <div id="div1" align="left" width="200px"> 
document.getElementById("div1").removeAttribute("align"); 
// now: <div id="div1" width="200px">

注記

setAttribute を使って属性の値に null をセットする代わりに removeAttribute を使用すべきです。

要素にない属性を取り除こうと試みても例外は発生しません。

DOMメソッドは要素の属性を取り扱います。

名前空間に無関係、最も一般的に使用されるメソッド 名前空間に限定される変数 (DOM Level 2) Attr ノードを直接扱うためのDOMレベル1のメソッド (ほとんど使用されない) Attr ノードを直接扱うための DOMレベル2 名前空間に限定されるメソッド(ほとんど使用されない)
setAttribute (DOM 1) setAttributeNS setAttributeNode setAttributeNodeNS
getAttribute (DOM 1) getAttributeNS getAttributeNode getAttributeNodeNS
hasAttribute (DOM 2) hasAttributeNS - -
removeAttribute (DOM 1) removeAttributeNS removeAttributeNode -


言語

Page last modified 23:19, 2008年6月9日 by Mgjbot

ファイル (0)