DHTML formatting

There are many useful DHTML formats to use. Perhaps the most useful ones are those which aid the viewers in their search for information or which display elements in ways which improve the communication of that information.

Rollover text, for instance, is a DHTML feature which changes the attributes of text, as it appears on the browser, when the cursor pointer passes over it. A common use of this feature is to make the text larger and therefore more legible. This could be used for links or for important information such as the phone number of an organization to which the web site refers.

Another use for this feature is to replace images with other images when the pointer passes over it. The code for this dynamic change is:
<DIV> onMouseOver="aa.src='image2.gif'" onMouseOut="aa.src='image1.gif'" > <IMG SRC="image1.gif" ID="aa"> </DIV>
In this sample code aa denotes the assigned ID of the dynamic feature, image1.gif is the image which appears first and which returns when the pointer moves off the image, and image2.gif is the image which appear when the pointer passes over the first image.

Style sheets are a particularly useful type of feature which are included in the DHTML category. They can save the coder a lot of time by establishing a simple way of setting styles. This can be done in three ways:

  • Inline style sheet, which appears in the body of the html text
  • Embedded style sheets, which are added between the headin tags at the beginning of the document
  • External style sheets, which are separate documents referenced into the html document.

  • There are a number of very good tutorials about style sheets. CNET.com has a good introductory tutorial.