You learned quite a bit in this chapter. You learned the following cross-browser BOM objects:
window
object, such as navigator
, location
, history
, frames
, screen
setInterval()
and setTimeout()
; alert()
, confirm()
and prompt()
; moveTo/By()
and resizeTo/By()
Then, you learned about the DOM, an API to represent an HTML or XML document as a tree structure, where each tag or text is a node on the tree. You also learned how to perform the following actions:
parentNode
, childNodes
, firstChild
, lastChild
, nextSibling
, and previousSibling
getElementsById()
, getElementsByTagName()
, getElementsByName()
, and querySelectorAll()
innerHTML
or innerText/textContent
nodeValue
or setAttribute()
, or just using attributes as object properties
removeChild()
or replaceChild()
appendChild()
, cloneNode()
, and insertBefore()
You also learned the following DOM 0 (pre-standardization) properties, ported to DOM Level 1:
document.forms
, images
, links
, anchors
, applets
. Using these are discouraged as DOM1 has the much more flexible getElementsByTagName()
method.document.body
element, which gives you convenient access to <body>
.document.title
, cookie
, referrer
, and domain
.Next, you learned how the browser broadcasts events that you can listen to. It's not straightforward to do this in a cross-browser manner, but it's possible. Events bubble up, so you can use event delegation to listen to events more globally. You can also stop the propagation of events and interfere with the default browser behavior.
Finally, you learned about the XMLHttpRequest
object that allows you to build responsive web pages that do the following tasks:
3.139.238.76