Write a program that uses Methods and properties of HTML DOM?

Write a program that uses Methods and properties of HTML DOM?



- HTML DOM uses getElementById method in the JavaScript form to access the element’s id and make changes accordingly.

- There are properties like childNodes and nodeValue used to get the content using an element.

<html>
<body>
<p id="intro">Hello World!</p>
<script type="text/javascript">
txt=document.getElementById("intro").childNodes[0].nodeValue;
document.write("<p>The text from the intro paragraph: " + txt + "</p>");
</script>
</body>
</html>

- The use of innerHTML property being used by applying the learning method that is useful and easily understandable by the tree structure of DOM.
Post your comment