DOM(Document Object Model) is a programming API for HTML and XML doc. The Document object has various properties that refer to other objects which allow access to and modification of document content.
These are some typical DOM properties: The command that can be used in XML DOM is as follows: Set objParser = CreateObject( “Microsoft.XMLDOM” ) The program that is used to represent the structure of the DOM: <html> <head> <title>DOM Tutorial</title> </head> <body> <h1>DOM Lesson one</h1> <p>Hello world! </p> </body> </html> <title>DOM </title>, element node <title> The code that shows the relationship is as follows: <html> <head> <title>DOM </title> </head> <body> <h1>DOM </h1> <p>Hello world!</p> </body> </html> The DOM property that exists in HTML: x.innerHTML – this stores the text value of x used to display it on the x axis. x.nodeName – this stores the node name of x on the x axis of the node. x.nodeValue – this provides the value of x for the node that is being used. HTML DOM provides methods to simplify the tasks and the methods are as follows: x.getElementById(id) – this allow the getting of the element that is associated with a specified id. x.getElementsByTagName(name) – this gets all the elements using the tag name that is associated with it. x.appendChild(node) – this inserts a child node to x and append the child node at the end of the tree. x.removeChild(node) – this removes a child node from x and remove from the tree area also. The example of it is shown below by using the <p> element properties as: <html> <body> <p id=”intro”>Hello World!</p> <script type=”text/javascript”> txt=document.getElementById(“intro”).innerHTML; document.write(“<p>Hello world: ” + txt + “</p>”); </script> </body> </html> 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. Node is used in HTML DOM as an object that points to the other element in the tree and gets generated by the root node. Nodes in an object form have some methods and properties that allow the accessing of the JavaScript to be used for modification. The node properties include the following things: The example that allows the change is as follows: <html> <body> <script type=”text/javascript”> document.body.bgColor=”green”; </script> </body> </html> The example is shown below that is used to change the HTML element values: <html> <body> <input type=”button” onclick=”document.body.bgColor=’green’;” value=”Change background color” /> </body> </html>What is the main function of DOM?
What are the HTML DOM Properties?
What are the levels involved in DOM?
What is the use or function of XML DOM?
What is the use or function of HTML DOM?
What is the use of DOM in W3C standards?
Write a program that shows the use of DOM?
What are the errors made while processing the DOM?
What is the purpose of HTML DOM Node Tree?
How does the relationship exist between the node, child and siblings in node-tree?
Explain through program the relationship that exists between the root and other nodes present in node-tree?
What is the programming interface used for DOM or HTML documents?
What are the methods involved in HTML DOM?
What are the properties of HTML DOM involved in the system?
Write a program that uses Methods and properties of HTML DOM?
What are the different properties of Nodes?
Write a program to change an HTML element?
Write a program to change the HTML element using events?
What are the functionalities performed by onload() and onUpload()?
Related posts:
- CSS3 Interview Questions and Answers
- DHTML Interview Questions and Answers
- Django Interview Questions and Answers
- GWT Interview Questions and Answers
- HTML Interview Questions and Answers
- HTML5 Interview Questions and Answers
- jQuery Interview Questions and Answers
- UI Developer Interview Questions and Answers