Java Reference
In-Depth Information
Now all you have to do is invoke the displayDogs() function. To do this, place a hyperlink in the
page's body to call the function when clicked.
<a href=”javascript: displayDogs();”>Display Dogs</a>
Summary
This chapter has featured quite a few diversions and digressions, but these were necessary to demon-
strate the position and importance of the Document Object Model in JavaScript.
This chapter covered the following points:
You started by outlining four of the main standards — HTML, ECMAScript, XML, and
XHTML — and examined the relationships among them. You saw that a common aim emerg-
ing from these standards was to provide guidelines for coding HTML web pages. Those
guidelines in turn benefi ted the Document Object Model, making it possible to access and
manipulate any item on the web page using script if web pages were coded according to these
guidelines.
You examined the Document Object Model and saw that it offered a browser- and language-
independent means of accessing the items on a web page, and that it resolved some of the
problems that dogged older browsers. You saw how the DOM represents the HTML document
as a tree structure and how it is possible for you to navigate through the tree to different ele-
ments and use the properties and methods it exposes in order to access the different parts of
the web page.
Although sticking to the standards provides the best method for manipulating the contents
of the web page, none of the main browsers yet implements it in its entirety. You looked at
the most up-to-date examples and saw how they provided a strong basis for the creation of
dynamic, interoperable web pages because of their support of the DOM.
Despite leaps and bounds by browser makers, some discrepancies still exist. You learned how
to cope with two different event objects by branching your code to consolidate two different
APIs into one.
DHTML enables you to change a page after it is loaded into the browser, and you can perform
a variety of user interface tricks to add some fl air to your page.
You learned how to change a tag's style by using the
style and className properties.
You also learned the basics of animation in DHTML and made text bounce back and forth
between two points.
Finally, you learned how to load an XML fi le and then manipulate its document with JavaScript.
Search WWH ::




Custom Search