HTML DOM object and javascript
DOM level 0 is the window object. The window object contains location, history, navigator and document objects. The document object is DOM level 2, it is the html document which consist of html tags.
These are some of the location properties with the window location info. You can pass them into the alert() or console.log(), or document.write() to see what’s in these properties.
window.location.hash window.location.host window.location.hostname window.location.href window.location.pathname window.location.port window.location.protocol
These are history functions that you can use to go to the previouse page, go to the next page or go to a specific offset in the history list.
window.history.back(); window.history.forward(); window.history.go();
These are some of the navigator properties contain your browser info. Again, uou can pass them into the alert() or console.log(), or document.write() to see what’s in these properties.
window.navigator.appCodeName window.navigator.appName window.navigator.appVersion window.navigator.userAgent
These are some of the document properties and methods in window object. Again, the document object is the DOM level 2 object, it is also the html file.
window.document.URL //The current page url window.document.body //The html body element window.document.URL //The document url window.document.bgColor //The document backgroun color window.document.URL //The document url window.document.createElement(); //Create an html element window.document.getElementById(); //Get html element by id window.document.write(); //Write something to the document window.document.URL //The document url
Search within Codexpedia
Search the entire web