spacer

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

home / experts / dhtml / column12
Developer News
Google Going Native With Chrome
Mozilla Fixes Firefox Flaws as 3.5 Release Nears
Microsoft and Novell Still Bosom Buddies

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

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
XML and PHP Simplified · Creating a ASP.NET Contact Form · Data Filtering with PHP
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Intel to Host Live Nehalem Q&A · 12 Tips to Troubleshoot Network File-Sharing · 10 Tips for Selling on Kijiji

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

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