Explain How to change HTML Attribute using HTML DOM?
Submitted by: Administratorexample to change HTML Attribute by using HTML DOM.
Example:
<html>
<body>
<img id="image" src="oldimage.gif">
<script type="text/javascript">
document.getElementById("image").src="newimage.jpg";
</script>
</body>
</html>
In the above example we load an image on HTML document by using id="image".Using DOM we get the element with id="image".JavaScript that we used in example to changes the src attribute from oldimage.gif to newimage.jpg
Submitted by: Administrator
Example:
<html>
<body>
<img id="image" src="oldimage.gif">
<script type="text/javascript">
document.getElementById("image").src="newimage.jpg";
</script>
</body>
</html>
In the above example we load an image on HTML document by using id="image".Using DOM we get the element with id="image".JavaScript that we used in example to changes the src attribute from oldimage.gif to newimage.jpg
Submitted by: Administrator
Read Online HTML DOM Job Interview Questions And Answers
Top HTML DOM Questions
☺ | Explain the syntax of UI object identifier used by DOM extension? |
☺ | Explain multi-tagging? |
☺ | Explain How to change HTML Attribute using HTML DOM? |
☺ | Explain DOM and how does it relate to XML? |
☺ | What is difference between DOM and SAX? What would we use if an option is given? |
Top Coding/Programming Categories
☺ | Python Interview Questions. |
☺ | OOP Interview Questions. |
☺ | Software engineering Interview Questions. |
☺ | PHP Interview Questions. |
☺ | VBA (Visual Basic for Applications) Interview Questions. |