Sams Teach Yourself HTML 4 in 24 Hours

Sams Teach Yourself HTML 4 in 24 Hours

By Dick Oliver

Offering Alternate Content in Plain HTML

There's one more <div> layer in Figure 20.3 that I haven't mentioned yet. The code for it looks like the following:

<div style="position: absolute;
 left: -250px; top: 10px; width: 250">
Your browser can't cope with this DHTML page.<p>
<a href="nodhtml.htm">Click here for a regular HTML page.</a>
<p></div>

Like the "intro" layer mentioned earlier, this layer is nothing more than a little text positioned completely out of view beyond the edge of the browser window. The point here is that older browsers that don't support style sheet positioning won't know enough to hide this layer; those browsers' users will see the text telling them how lame their browser is and offering a link to an alternative page—presumably one that doesn't use any Dynamic HTML jugglery.

Figure 20.4 shows what the page from Figures 20.1 to 20.3 looks like when viewed with the Opera browser, which doesn't support style sheets or JavaScript. The style and id attributes of the <div> tags have no effect at all in Opera, so the contents of all the layers are displayed one after the other down the page.

20fig04.gif

Figure 20.4 When the page in Figures 20.1 to 20.3 is viewed in Opera 3.21, a link to an alternate page appears.

When a user follows the "Click here for a regular HTML page" link in Figure 20.4, she gets the nodhtml.htm document shown in Figure 20.5. You can make any page you want and name it nodhtml.htm (or change the "nodhtml.htm" reference to the page of your choice). Instead of telling the user that her browser isn't advanced enough for your state-of-the-art pages, you might choose instead to simply present equivalent content without the fancy DHTML animation.

20fig05.gif

Figure 20.5 Clicking the link in Figure 20.4 takes the user to a plain-vanilla HTML page, with no DHTML enhancements.

Share ThisShare This

Informit Network