JavaScript DHTML/Node Operation/setAttributeNode

Материал из Web эксперт
Версия от 10:25, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

"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>