9DOM Scripting
WHAT YOU WILL LEARN IN THIS CHAPTER:
- Finding elements in the page
- Creating and inserting elements into the page dynamically
- Navigating the web page, travelling from one element to another
- Changing elements’ style after they are loaded in the page
- Animating elements by manipulating their positioning
WROX.COM CODE DOWNLOADS FOR THIS CHAPTER
You can find the wrox.com code downloads for this chapter at http://www.wiley.com/go/BeginningJavaScript5E
on the Download Code tab. You can also view all of the examples and related files at http://beginningjs.com
.
JavaScript’s primary role in web development is to interact with the user, to add some kind of behavior to your web page. JavaScript enables you to completely change all aspects of a web page after it’s loaded in the browser. What gives JavaScript this power over a web page is the document object model (DOM), a tree-like representation of the web page.
The DOM is one of the most misunderstood standards set forth by the World Wide Web Consortium (W3C), a body of developers who recommend standards for browser makers and web developers to follow. The DOM gives developers a way of representing everything on a web page so that it is accessible via a common set of properties and methods in JavaScript. By everything, we mean everything. You can literally change anything on the page: the graphics, tables, forms, style, and even text itself by altering a relevant DOM property with JavaScript.
The DOM should ...
Get Beginning JavaScript, 5th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.