spacer

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

home / experts / javascript / column76


Netscape 6, Part V: DOCJSLIB 1.1

Developer News
News Flash: Adobe Has iPhone Workaround
Adobe's Flash 10.1 Goes Mobile (Minus iPhone)
A Salute to Visionary CEOs

The IMG Model

We have described earlier the differences in the DHTML models of Netscape Navigator and Internet Explorer. Both browsers support the DIV tag, so it is obviously the first choice that comes to mind when going to implement a cross-browser DHTML tag. The problem is that the DIV tag in Netscape Navigator does not support the onClick() event handler.

We have found that the DIV/A/IMG combination is the best fit for both browsers. The DIV tag provides the Style Sheet attributes that you can use for controlling its behavior. The A tag provides the onClick() event handler capabilities. The IMG tag is needed to provide a clicking area for the A tag, since the ancestor DIV tag cannot provide a clicking area for the descendent A tag.

The combination DIV/A/IMG describes the order among these tags. The A tag is a descendent of the DIV tag, and the IMG tag is a descendent of the A tag:

<DIV....>
   <A....>
      <IMG....>
   </A>
</DIV>

A mouse clicking in the image area of the IMG tag is identical to clicking any other HTML link. As explained later in this column, the link is not pointing to a URL, but rather to a JavaScript function that handles the clicking event.

Controlling the Style Sheet attributes is accomplished via a STYLE tag that is associated with the DIV tag. The final skeleton of our DHTML model is:

<STYLE....>
.
.
.
.
</STYLE
<DIV....>
   <A....>
      <IMG....>
   </A>
</DIV>

The image's GIF is controlled via the IMG tag's SRC attribute. It is not recommended to play around with the DIV tag's SRC attribute, and so we don't get or set it. We only set the IMG tag's SRC attribute.

Next: How to use the makeImage() function

http://www.internet.com

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 >
Building a Banking Application Home Page with OOP · Mixing Scripting Languages · Review: phpFox, a Social Networking CMS with all the Bells and Whistles
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Enterprise 2.0: Social Networking in the Cloud · BroadSoft Marketplace Hastens Pace of Telephony Innovation · Review: HTC Hero for Sprint


Produced by Yehuda Shiran and Tomer Shiran
All Rights Reserved. Legal Notices.
Created: January 29, 2001
Revised: January 29, 2001

URL: http://www.webreference.com/js/column76/4.html