Greetings Will Robinson
ack when I was a bachelor, I was never quite sure what to do in many social situations. I can remember awkward forays into dance clubs, where I was ignored except for the occasional woman who would ask if I had any drugs to sell. Now that I get my hair cut more frequently, that problem has all but vanished. I've also learned about the benefits of sending cards for all occasions. Mother's Day? Valentine's Day? Programmer's Day? It doesn't matter. They each need a special greeting. Of course, finding a stamp is a different issue. Fortunately, the Internet has solved that. It is simple to send animated greeting cards, with no stamps required. And the Web abounds with them.
This month I'll show some Dynamic HTML techniques you can use to create animated greeting cards. I'll also satisfy the requests of several readers by showing how to modify the page so that it will work with Netscape Navigator. Believe it or not, there are still a bunch of folks out there using Netscape products. And since Netscape was kind enough to rename their object model to Dynamic HTML (sending the world into confusion about what Dynamic HTML is, and whether anything written in Dynamic HTML will work on both Microsoft® Internet Explorer 4.0 and Navigator 4.0), I'll break through some of the confusion.
First, let me state that what Microsoft Internet Explorer 4.0 calls Dynamic HTML and what Netscape Navigator 4.0 calls Dynamic HTML are completely different. Currently, Internet Explorer 4.0 provides a far broader and more powerful object model than Navigator 4.0. Now, let's take a look at how the two browsers work, and then see how to write for both of them. Let me warn you that this discussion is by no means exhaustive. There certainly are more things you can do to target both browsers, and more nuances and twists
than I will explore here. In fact, I have purposefully chosen
a sample page that only uses features readily available in
both browsers.
What's Up, Doc?
Rather than describe the differences between the two browsers, I'll go through the far shorter list of similarities. In addition to the standard HTML 3.0 level capabilities, both browsers will let you:
- Use 2D positioning for DIVs and SPANs
- Change the visibility of DIVs and SPANs
- Trap mouse events for DIVs and SPANs
- Trap mouse events for image maps
- Get collections of DIVs and SPANs
- Change the background color of text dynamically
Fortunately, these capabilities are more than I need for creating an animated greeting card. The card will be simple, with just a picture at the top and a message below. The letters in the message will cycle, kind of like a marquee; unlike a marquee, the individual letters will stay in place. Figure 1 shows several pictures of the page over time. The images and letters are easily changed, of course.
|