SlideShare a Scribd company logo
1 of 4
<!DOCTYPE html>
<html>
<body>
<p>Click the button to display the URL of the document.</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
var x = document.URL;
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>
OUTPUT
Click the button to display the URL of the document.
http://www.w3schools.com/jsref/tryit_view.asp?x=0.10356133664026856
HTML DOM Nodes
In the HTML DOM (Document Object Model), everything is a node:
 The document itself is a document node
 All HTML elements are element nodes
 All HTML attributes are attribute nodes
 Text inside HTML elements are text nodes
 Comments are comment nodes
The Document Object
When an HTML document is loaded into a web browser, it becomes a document object.
The document object is the root node of the HTML document and the "owner" of all other nodes:
(element nodes, text nodes, attribute nodes, and comment nodes).
The document object provides properties and methods to access all node objects, from within JavaScript.
Tip: The document is a part of the Window object and can be accessed as window.document.
Document ObjectPropertiesand Methods
The following properties and methods can be used on HTML documents:
Property / Method Description
document.activeElement Returns the currently focused element in the document
document.addEventListener() Attaches an event handler to the document
document.adoptNode() Adopts a node from another document
Tryit
document.anchors Returns a collection of all <a> elements in the document that
have a name attribute
document.applets Returns a collection of all <applet> elements in the document
document.baseURI Returns the absolute base URI of a document
document.body Sets or returns the document's body (the <body> element)
document.close() Closes the output stream previously opened with
document.open()
document.cookie Returns all name/value pairs of cookies in the document
document.createAttribute() Creates an attribute node
document.createComment() Creates a Comment node with the specified text
document.createDocumentFragment() Creates an empty DocumentFragment node
document.createElement() Creates an Element node
document.createTextNode() Creates a Text node
document.doctype Returns the Document Type Declaration associated with the
document
document.documentElement Returns the Document Element of the document (the <html>
element)
document.documentMode Returns the mode used by the browser to render the document
document.documentURI Sets or returns the location of the document
document.domain Returns the domain name of the server that loaded the docume
document.domConfig Obsolete. Returns the DOM configuration of the document
document.embeds Returns a collection of all <embed> elements the document
document.forms Returns a collection of all <form> elements in the document
document.getElementById() Returns the element that has the ID attribute with the specified
value
document.getElementsByClassName() Returns a NodeList containing all elements with the specified
class name
document.getElementsByName() Returns a NodeList containing all elements with a specified
name
document.getElementsByTagName() Returns a NodeList containing all elements with the specified
name
document.hasFocus() Returns a Boolean value indicating whether the document has
focus
document.head Returns the <head> element of the document
document.images Returns a collection of all <img> elements in the document
document.implementation Returns the DOMImplementation object that handles this
document
document.importNode() Imports a node from another document
document.inputEncoding Returns the encoding, character set,used for the document
document.lastModified Returns the date and time the document was last modified
document.links Returns a collection of all <a> and <area> elements in the
document that have a href attribute
document.normalize() Removes empty Text nodes, and joins adjacent nodes
document.normalizeDocument() Removes empty Text nodes, and joins adjacent nodes
document.open() Opens an HTML output stream to collect output from
document.write()
document.querySelector() Returns the first element that matches a specified CSS selector
in the document
document.querySelectorAll() Returns a static NodeList containing all elements that matches
specified CSS selector(s) in the document
document.readyState Returns the (loading) status of the document
document.referrer Returns the URL of the document that loaded the current
document
document.removeEventListener() Removes an event handler from the document (that has been
attached with theaddEventListener() method)
document.renameNode() Renames the specified node
document.scripts Returns a collection of <script> elements in the document
document.strictErrorChecking Sets or returns whether error-checking is enforced or not
document.title Sets or returns the title of the document
document.URL Returns the full URL of the HTML document
document.write() Writes HTML expressions or JavaScript code to a document
document.writeln() Same as write(), but adds a newline character after each
statement
1) DOM parser loads whole xml document in memory while SAX only loads small part of XML file in
memory.
2) DOM parser is faster than SAX because it access whole XML document in memory.
3) SAX parser in Java is better suitable for large XML file than DOM Parser because it doesn't require
much memory.
4) DOM parser works on Document Object Model while SAX is an event based xml parser.

More Related Content

What's hot

Java script frame history
Java script frame historyJava script frame history
Java script frame history
H K
 
User controls
User controlsUser controls
User controls
aspnet123
 
ABV_fastcontact
ABV_fastcontactABV_fastcontact
ABV_fastcontact
arjun rao
 
Restful services-slides
Restful services-slidesRestful services-slides
Restful services-slides
MasterCode.vn
 

What's hot (16)

Examplecode
ExamplecodeExamplecode
Examplecode
 
Java script frame history
Java script frame historyJava script frame history
Java script frame history
 
CRUD VB2010
CRUD VB2010CRUD VB2010
CRUD VB2010
 
Database connectivity with data reader by varun tiwari
Database connectivity with data reader by varun tiwariDatabase connectivity with data reader by varun tiwari
Database connectivity with data reader by varun tiwari
 
Mule esb – connecting to ms sql db
Mule esb – connecting to ms sql dbMule esb – connecting to ms sql db
Mule esb – connecting to ms sql db
 
Slick: Bringing Scala’s Powerful Features to Your Database Access
Slick: Bringing Scala’s Powerful Features to Your Database Access Slick: Bringing Scala’s Powerful Features to Your Database Access
Slick: Bringing Scala’s Powerful Features to Your Database Access
 
mediator
mediatormediator
mediator
 
jQuery basics for Beginners
jQuery basics for BeginnersjQuery basics for Beginners
jQuery basics for Beginners
 
AWS Atlanta meetup CloudFormation conditionals
AWS Atlanta meetup CloudFormation conditionals AWS Atlanta meetup CloudFormation conditionals
AWS Atlanta meetup CloudFormation conditionals
 
The Principle of Hybrid App.
The Principle of Hybrid App.The Principle of Hybrid App.
The Principle of Hybrid App.
 
Exp6
Exp6Exp6
Exp6
 
Angular 2.0 Views
Angular 2.0 ViewsAngular 2.0 Views
Angular 2.0 Views
 
State management in asp
State management in aspState management in asp
State management in asp
 
User controls
User controlsUser controls
User controls
 
ABV_fastcontact
ABV_fastcontactABV_fastcontact
ABV_fastcontact
 
Restful services-slides
Restful services-slidesRestful services-slides
Restful services-slides
 

Similar to Url&doc html

java API for XML DOM
java API for XML DOMjava API for XML DOM
java API for XML DOM
Surinder Kaur
 
Week32
Week32Week32
Week32
H K
 
12. session 12 java script objects
12. session 12   java script objects12. session 12   java script objects
12. session 12 java script objects
Phúc Đỗ
 

Similar to Url&doc html (20)

Web 6 | JavaScript DOM
Web 6 | JavaScript DOMWeb 6 | JavaScript DOM
Web 6 | JavaScript DOM
 
FYBSC IT Web Programming Unit III Document Object
FYBSC IT Web Programming Unit III  Document ObjectFYBSC IT Web Programming Unit III  Document Object
FYBSC IT Web Programming Unit III Document Object
 
java API for XML DOM
java API for XML DOMjava API for XML DOM
java API for XML DOM
 
Java script
Java scriptJava script
Java script
 
DOM and Events
DOM and EventsDOM and Events
DOM and Events
 
Week32
Week32Week32
Week32
 
DOM specifics
DOM specificsDOM specifics
DOM specifics
 
12. session 12 java script objects
12. session 12   java script objects12. session 12   java script objects
12. session 12 java script objects
 
Automating Ievb
Automating IevbAutomating Ievb
Automating Ievb
 
Dom
Dom Dom
Dom
 
Capstone ms2
Capstone ms2Capstone ms2
Capstone ms2
 
Functional GUIs with F#
Functional GUIs with F#Functional GUIs with F#
Functional GUIs with F#
 
Xml dom & sax by bhavsingh maloth
Xml dom & sax by bhavsingh malothXml dom & sax by bhavsingh maloth
Xml dom & sax by bhavsingh maloth
 
J Query
J QueryJ Query
J Query
 
Dom
DomDom
Dom
 
IT6801-Service Oriented Architecture-Unit-2-notes
IT6801-Service Oriented Architecture-Unit-2-notesIT6801-Service Oriented Architecture-Unit-2-notes
IT6801-Service Oriented Architecture-Unit-2-notes
 
J Query Public
J Query PublicJ Query Public
J Query Public
 
J Query Presentation of David
J Query Presentation of DavidJ Query Presentation of David
J Query Presentation of David
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
Introduction to JQuery
Introduction to JQueryIntroduction to JQuery
Introduction to JQuery
 

Recently uploaded

VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
dharasingh5698
 

Recently uploaded (20)

COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdf
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086
 
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 

Url&doc html

  • 1. <!DOCTYPE html> <html> <body> <p>Click the button to display the URL of the document.</p> <button onclick="myFunction()">Try it</button> <p id="demo"></p> <script> function myFunction() { var x = document.URL; document.getElementById("demo").innerHTML = x; } </script> </body> </html> OUTPUT Click the button to display the URL of the document. http://www.w3schools.com/jsref/tryit_view.asp?x=0.10356133664026856 HTML DOM Nodes In the HTML DOM (Document Object Model), everything is a node:  The document itself is a document node  All HTML elements are element nodes  All HTML attributes are attribute nodes  Text inside HTML elements are text nodes  Comments are comment nodes The Document Object When an HTML document is loaded into a web browser, it becomes a document object. The document object is the root node of the HTML document and the "owner" of all other nodes: (element nodes, text nodes, attribute nodes, and comment nodes). The document object provides properties and methods to access all node objects, from within JavaScript. Tip: The document is a part of the Window object and can be accessed as window.document. Document ObjectPropertiesand Methods The following properties and methods can be used on HTML documents: Property / Method Description document.activeElement Returns the currently focused element in the document document.addEventListener() Attaches an event handler to the document document.adoptNode() Adopts a node from another document Tryit
  • 2. document.anchors Returns a collection of all <a> elements in the document that have a name attribute document.applets Returns a collection of all <applet> elements in the document document.baseURI Returns the absolute base URI of a document document.body Sets or returns the document's body (the <body> element) document.close() Closes the output stream previously opened with document.open() document.cookie Returns all name/value pairs of cookies in the document document.createAttribute() Creates an attribute node document.createComment() Creates a Comment node with the specified text document.createDocumentFragment() Creates an empty DocumentFragment node document.createElement() Creates an Element node document.createTextNode() Creates a Text node document.doctype Returns the Document Type Declaration associated with the document document.documentElement Returns the Document Element of the document (the <html> element) document.documentMode Returns the mode used by the browser to render the document document.documentURI Sets or returns the location of the document document.domain Returns the domain name of the server that loaded the docume document.domConfig Obsolete. Returns the DOM configuration of the document document.embeds Returns a collection of all <embed> elements the document document.forms Returns a collection of all <form> elements in the document document.getElementById() Returns the element that has the ID attribute with the specified value document.getElementsByClassName() Returns a NodeList containing all elements with the specified
  • 3. class name document.getElementsByName() Returns a NodeList containing all elements with a specified name document.getElementsByTagName() Returns a NodeList containing all elements with the specified name document.hasFocus() Returns a Boolean value indicating whether the document has focus document.head Returns the <head> element of the document document.images Returns a collection of all <img> elements in the document document.implementation Returns the DOMImplementation object that handles this document document.importNode() Imports a node from another document document.inputEncoding Returns the encoding, character set,used for the document document.lastModified Returns the date and time the document was last modified document.links Returns a collection of all <a> and <area> elements in the document that have a href attribute document.normalize() Removes empty Text nodes, and joins adjacent nodes document.normalizeDocument() Removes empty Text nodes, and joins adjacent nodes document.open() Opens an HTML output stream to collect output from document.write() document.querySelector() Returns the first element that matches a specified CSS selector in the document document.querySelectorAll() Returns a static NodeList containing all elements that matches specified CSS selector(s) in the document document.readyState Returns the (loading) status of the document document.referrer Returns the URL of the document that loaded the current document document.removeEventListener() Removes an event handler from the document (that has been attached with theaddEventListener() method)
  • 4. document.renameNode() Renames the specified node document.scripts Returns a collection of <script> elements in the document document.strictErrorChecking Sets or returns whether error-checking is enforced or not document.title Sets or returns the title of the document document.URL Returns the full URL of the HTML document document.write() Writes HTML expressions or JavaScript code to a document document.writeln() Same as write(), but adds a newline character after each statement 1) DOM parser loads whole xml document in memory while SAX only loads small part of XML file in memory. 2) DOM parser is faster than SAX because it access whole XML document in memory. 3) SAX parser in Java is better suitable for large XML file than DOM Parser because it doesn't require much memory. 4) DOM parser works on Document Object Model while SAX is an event based xml parser.