Chapter 5. Using Core HTML PropertiesIn the coming chapters, we're going to see a great many HTML elements and browser objects. Each of these elements and objects has properties, methods, and events; and if we were to list them all for each item, we would need more space than there is in this book. However, a great many JavaScript properties, methods , and events are common to nearly all HTML elements and to many browser objects, so I'll collect them into this and the next chapter, calling them JavaScript's core HTML properties, methods, and events . This chapter covers JavaScript's core HTML properties, and the next chapter (Chapter 6, "Using Core HTML Methods and Events") covers JavaScript's core HTML methods and events. So when you want to look up the properties, methods, and events of an object, such as the window object, or a text field, or a button, you turn to the chapter that covers the object you wantone of Chapters 715. Some of the properties, methods, and events you find in those chapters will be JavaScript core items, and those chapters will refer you back to Chapters 5 and 6 for those items. Take a look at the Table 5.1, for example, which is a partial listing of the methods of the window object from Chapter 8, "Using window and frame Methods and Events" it's the beginning of Table 8.3. The attachEvent method is marked "See Chapter 6," indicating that this method is covered in Chapter 6. The attachEvent method is also a method of the document object, covered in Chapter 9, "Using the document and body Objects." And it's a method of the HTML text elements in Chapter 11, "Working with HTML Text Elements," as well as a method of the HTML form objects covered in Chapters 12, "Working with Forms, Buttons, Check Boxes, and Radio Buttons," 13, "Working with Text and Select Controls," 14, "Working with Links, Lists, and Tables," and so on. As you can see, collecting JavaScript's HTML core properties, methods, and events here in Chapters 5 and 6 will save us an immense amount of duplication in later chapters (in fact, more duplication than would fit into the book). Table 5.1. Partial List of the Methods of the window Object (from Table 8.3)
In this chapter, therefore, we're going to take a look at JavaScript's core HTML properties; these properties apply to nearly all HTML elements (such as <BODY> , <P> , <INPUT>, and so on) and to many browser objects (such as window , document , and so on) as well, as we'll see in the coming chapters. For example, the id property holds an object's ID value, as set in its ID attribute. The tagName property holds an element's tag name (such as "P" for a <P> element). The children property holds any child elements enclosed in an element, and so on. Note that to cover all JavaScript's core HTML properties, methods, and events, we'll occasionally need to cover some topics that we haven't discussed yet and which are coming up in later chapters, such as style sheets or Dynamic HTML. That won't be a problem for the most part, but feel free to skip that material until you need it when dealing with the programming in later chapters. So from where do JavaScript's core HTML properties that we're going to cover come? Although more have developed over the years , they originally came from HTML attributes. |