HTML and CSS Reference
In-Depth Information
For example, in the “Types of data” section earlier in this chapter, you saw how the naviga-
tor.platform property was used to i nd the type of computer in use.
h e HTML5 DOM itself has far more objects, and the most used is the Document property.
h e list of objects is the same as the list of elements. So, a list of all the DOM objects is a list of
all elements, plus some others that are used in conjunction with the DOM. For example, the
following are included in the HTML5 DOM but aren't exactly elements:
Some of these objects we see in tags. For example, the image object is seen in the <img> tags.
Its properties are similar to the img element's attributes. Others, like document are implied
in that a Web page is the document. h e event object is employed in event handling with
methods such as onClick . h e rest are elements, so they should be familiar. But instead
of attributes in a tag, expect to i nd properties with the same names and functions as equiva-
lent attributes.
Data sources are important to understand, and one way to understand them is to practice
using dif erent types. h e challenge is to do the following:
1. Select a string — one of your favorite sayings or pieces of information. For example,
“All objects are made up of properties and methods.”
2. Assign the string to a variable and use document.write() to send it to the screen.
3. Break down the string into several separate words and place each word into a
dif erent array element and then using the array.pop() method and document.
write() to display them on the screen in a single message.
4. Finally, create an object with a property that is assigned the string that you've
selected. Create a method for the property that displays the string to the screen.
Search WWH ::

Custom Search