Where as the responseText property of the XMLHTTPRequest object contains a string, responseXML can be treated as if it were an XML document.
This lesson looks at the DOM methods that can be used to actually create elements, thereby changing the structure of the page.
The Document Object Model can be thought of as a tree like structure of nodes. As well as reading the values associated with those nodes, you can create and modify the nodes themselves, thereby changing the structure and content of your document.
To add new element to a page, you need to first create the elements and then attach them to the appropriate point in your DOM tree. Let’s look at a simple example using the following HTML document:
We now need to attach textnode to the DOM tree of the document at the appropriate point.
In this case, we want our text to be inside the <div> container having the id displaydiv:
Below it shows the browser display after loading this page.
The DOM says "Hello World"
When you want to create other page elements besides text nodes, you can do so using the createElement() method, which works pretty much like create TextNode().We could, in fact, have used createElement() to create the <div> container itself, prior to adding our ‘Hello World!’ text node:
In general, you simply pass the type of the required page element as an argument to createElement() to generate the required type of element.
An Overview of DOM Methods
AJAX Related Interview Questions
|XML Interview Questions||HTML Interview Questions|
|Java Script Interview Questions||Android Interview Questions|
|CSS Interview Questions||Web Developer Guide Interview Questions|
|XSLT Interview Questions||Java XML Interview Questions|
|XML DOM Interview Questions|
Anatomy Of A Website
Writing Web Pages In Html
Sending Requests Using Http
Server-side Programming In Php
A Brief Introduction To Xml
Anatomy Of An Ajax Application
The Xmlhttprequest Object
Talking With The Server
Using The Returned Data
Our First Ajax Application
Returning Data As Text
Ahah-asynchronous Html And Http
Returning Data As Xml
Web Services And The Rest Protocal
Web Services Using Saop
The Prototype.js Toolkit
Using Xoad 193
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.