Document Object Model
The DOM is an object orientated representation of the document (or page) in memory
The browser reads the HTML file and identifies all the dependencies
Any external dependencies have to be requested from the server before it can build the DOM
The DOM represents the document structure, style and content
The contents of the DOM can be modified using an API
The browser uses the DOM and the standard APIs to allow the web page to be accessible from an ECMAScript scripting language (or JavaScript).
The following are examples of common APIs:
document.getElementById
element.innerHTML
window.onload
console.log
window object
The window object represents an open window in a browser.
This object has lots of properties and methods
window.location
window.alert(message);
window.confirm(message);
window.prompt(message, default)
Returns the query string portion of the URL (includes the question mark and everything after it)
window.location.search
window.location.origin
Events
window.onload //load event
link - w3schools.com/jsref/dom_obj_event.asp
window.scrollto
link - developer.mozilla.org/en-us/docs/web/api/window/scrollto
innerHTML
childNodes
firstChild
lastChild
© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext