Objects group together a set of variables and functions to create a modelof a something you would recognize from the real world. In an object,variables and functions take on new names
- IN AN OBJECT: VARIABLES BECOME KNOWN AS PROPERTIES
- IN AN OBJECT: FUNCTIONS BECOME KNOWN AS METHODS
The Document Object Model (DOM) specifies how browsers should create a model of an HTML page and how JavaScript can access and update the contents of a web page while it is in the browser window.
1- getElementByTagName
2- getElementByTagName.html
3- getElementByClassName
So far this chapter has focused on finding elements in the DOM tree. The rest of this chapter shows how to access/update element content. Your choice of techniques depends upon what the element contains.
The DOM also defines methods and properties to access and update each object in this model, which in turn updates what the user sees in the browser.
You will hear people call the DOM an Application Programming Interface (API). User interfaces let humans interact with programs; APls let programs (and scripts) talk to each other. The DOM states what your script can “ask the browser about the current page, and how to tell the browser to update what is being shown to the user.
A problem domain is simply looking at only the topics of an individual’s interest, and excluding everything else. For example, when developing a system to measure good practice in medicine, carpet drawings at hospitals would not be included in the problem domain
1- Locate the node that represents the element you want to work with.
2- Use its text content, child elements, and attributes.