CHAPTER 17Media Management

Web pages are not composed solely of text, but generally include a variety of dependent media items such as images (static and generated), videos, audio clips, and multimedia elements such as Flash files. In this chapter, we explore how JavaScript can be used to add and manipulate media elements. Our focus as a reference is primarily on syntax, though we do present a number of illustrative examples, both to present syntax in context and to illuminate common challenges that JavaScript programmers may face.

Image Handling

The images[] collection of the Document object contains Image objects (known as HTMLImageElement in the DOM1 specification) corresponding to all of the <img> tags in the document. Like all collections, ...

Get JavaScript The Complete Reference, 3rd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.