JavaScript DHTML/Node Operation/createAttribute

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

"createAttribute()" 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

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


     </source>