JavaScript DHTML/Node Operation/setAttributeNode

Материал из Web эксперт
Перейти к: навигация, поиск

"setAttributeNode()" Example

   <source lang="html4strict">
   

<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 This is another cell This is another cell This is another cell This is another cell This is another cell This is another cell This is another cell

<input id="myB" type="button" value="Add attribute to the table" onclick="function1();"> </body> </html>


     </source>