spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / dhtml / column12
Developer News
Mozilla's Ubquity Mashup: For The Masses?
iPhone Users Just Want to Have Fun
Oops! I Fixed the Linux Kernel
Logo

Expandable Outlines
Explorer 4: using toggled images


Click the triangles to expand the headings: (IE4 only)

Expand/Collapse Item World Wide Web Consortium (W3C)

Expand/Collapse Item Netscape

In the first example, above, the image is contained in a link, as our first example on the previous page:

The expandIt() function is modified to swap images, to reflect the expanded/collapsed state of the element:

Notice that the image to be swapped is identified as event.srcElement. That is, the element that received the event (click). Although the click was meant for the link (A) element, Explorer's bottom-up approach to event handling identifies the IMG as the event source element, and since this element does not define an action for the event, it is passed up to the A.

Explorer event handling is discussed in Dynamic Images, in the context of the column examples, and generally, in Doc JavaScript's The Internet Explorer Event Model.

The second example avoids the link, and uses onClick as an event handler of IMG.

Notes: The ALT attribute is displayed by both DHTML browsers when the mouse is over the image. This new behaviour makes ALT a "hint" or "extra info" attribute as well as a label for non-graphical or images-off browsers. Use it to provide information on links or click actions.
When Navigator 4 parses the STYLE attribute in the IMG tag, it renders the IMG and possibly succeding elements incorrectly. Although cursor:hand is a helpful property here, it should be used only in Explorer-specific applications.

The complete Explorer code is repeated in our first code page.

I know, it's not challenging. The same, however, cannot be said for the Navigator version!


Produced by Peter Belesis and



JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

webref The latest from WebReference.com Browse >
Performance Optimizations for High Speed JavaScript · Advanced Web Performance Optimization · Simple Comments Meets OpenID
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Extending Telephony: VoIP Call Recording for Business · U-Verse for Business Has Wi-Fi Perks · Lian-Li Launches New Power Supply Line, Rack Mount Kit and Fan Blower

All Rights Reserved. Legal Notices.
Created: Jan. 14, 1998
Revised: Jan. 18, 1998

URL: http://www.webreference.com/dhtml/column12/outIEtwo.html