Replacing an element on page using JavaScript - Javascript DOM

Javascript examples for DOM:Element nodeValue

Description

Replacing an element on page using JavaScript

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <script type="text/javascript">
            var p = {
                onload: function() {
                    var markerAttribute = document.createAttribute("marker");
                    document.getElementById("my").setAttributeNode(markerAttribute);
                    markerAttribute.nodeValue = "config";
                }/*from w  w  w .jav a  2s  .  c  o  m*/
            };
        
      </script> 
   </head> 
   <body onload="p.onload()"> 
      <div> 
         <player id="my"></player> 
      </div>  
   </body>
</html>

Related Tutorials