IN THIS CHAPTER
Differences among link, anchor, and a element objects
Scripting a link to invoke a script function
Scripting a link to swap an image on mouse rollovers
As scriptable objects going back to the first scriptable browsers, links and anchors are comparatively simple devices. But this simplicity belies their significance in the entire scheme of the Web. Under script control, links can be far more powerful than mere tethers to locations on the Web.
In modern browsers, the notion of separating links and anchors as similar yet distinctly different objects begins to fade. The association of the word link with objects is potentially confused by the newer browsers' recognition of the
link element (see Chapter 40, "HTML Directive Objects"), which has an entirely different purpose as a scriptable object. Taking the place of the anchor and link objects is an HTML element object representing the element created by the
<a> tag. As an element object, the
a element assumes all the properties, methods, and event handlers are associated with all HTML element ...