This week I looked at:
My understanding of these as of right now:
Browser Object Model (BOM): I’m still trying to distinguish this from the DOM in my head; I know that the BOM is browser-specific and as such doesn’t have the same level of standards that the DOM does. So it’s important to use the core BOM objects that are found cross-browser in order for scripts to be cross-browser friendly.
- window (represents the browser window)
- document (represents the HTML page)
This chapter also looked at some useful/interesting methods and properties for the other objects in this tree. In my list below, a word followed by () indicates a method. Otherwise it is a property.
- go() – can be passed a number value (positive or negative) to move backwards or forwards that amount of pages.
- back() – goes back to the previous loaded page in the browser.
- forward() – goes forward to the next loaded page in the browser.
- The href, hostname, port, and protocol properties return their respective information about the site being visited. href can also be used to point to another page.
- height, width, and colorDepth are properties which return their associated values. A later example in the chapter included an exercise to create a page that loads a different background color based on the colorDepth of the user’s browser.
- forms, images, and links – these properties are actually array-like structures called collections, which return all of the objects on a page for their respective type (so all of the images, or all of the links, etc.).
- write() or writeln() for printing a message to the page.
This chapter also looked at responding to user’s actions with events, which included an introduction/explanation of using onclick to intercept a click and perform an action (such as rotating/changing images).