JavaScript DHTML/Node Operation/removeAttribute

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

"removeAttribute()" Example

   <source lang="html4strict">
   

<html> <body> <script language="JavaScript">

   function function1(){
       var m = document.getElementById("myDiv").removeAttribute("id");
       document.all.myB.innerText = "Click again";
       if (m == true) {
           alert("Attribute removed"); 
       }
   }

</script>

This is a div element
This is another div element

<input id="myB" type="button" value="Remove id attribute" onclick="function1();"> </body> </html>


     </source>