JavaScript Reference/Javascript Methods/setAttributeNode
"setAttributeNode()" Example
<source lang="javascript">
<html> <body> <script language="JavaScript"> function function1() {
var newAttr = document.createAttribute("width"); newAttr.nodeValue = "400px" document.getElementById("myB").setAttributeNode(newAttr);
} </script>
Expand this table | This is another cell |
---|---|
<input id="myB" type="button" value="Add attribute to the table" onclick="function1();"> </body> </html>
</source>
"setAttributeNode()" is applied to
<source lang="javascript">
+----------------+--------------------------------------------------------------+ | Applied_To |<a> <acronym> | | |<address> <applet> | | |<area> | | |<base> <basefont> | | | <bgsound> |
| ||| |<body>
| | |<button>| | | | | |
| |<dir><col> | | |<colgroup> <comment> | | |<custom>
| | | || | |
- | | | <embed> | | |<fieldset> | | |<form> <frame> | | |<frameset> <head> | | |<hn>
|| |<html> | | |<iframe> <img> | | |<input> <input type="button"> | | |<input type="checkbox"> <input type="file"> | | |<input type="hidden"> <input type="image"> | | |<input type="password"> <input type="radio"> | | |<input type="reset"> <input type="submit"> | | |<input type="text"> | | |<isindex> | | |<label> <legend> |
| |- <link> | | |<listing> <map> | | |<marquee> <menu> | | |<meta> <nobr> | | |<noframes> <noscript> | | |<object>
| | |<optgroup> <option> | | |
<param> | | |<plaintext>
| | |