書式
obj.getAttributeNode(attrName)
対応
[IE6~][Firefox 1~][Safari 1~][Opera 8~][Netscape 6~]
説明
属性のノードを返します。Safari 2では読み出しのみでノード値を設定することができないようです。以下のサンプルも動作しません。
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=shift_jis">
<title>Sample</title>
<script type="text/javascript"><!--
function getAttrNode() {
var bgColorNode = document.body.getAttributeNode("bgcolor");
bgColorNode.value = "orange";
var buttonNode = document.getElementById("myButton").getAttributeNode("value");
buttonNode.value = "OK";
}
// --></script>
</head>
<body bgcolor="#fffff0">
<h1>getAttributeNode</h1>
<form>
<input type="button" id="myButton" value="Click" onClick="getAttrNode()">
</form>
</body>
</html>