|
|
||||
![]() | ||||
One of the side-effects of the way the .IF
command works is that you can use it to produce completely different HTML code
based on some condition, right down to the <HEAD> and <BODY>
tags.
This example produces one version of the document if the user's browser supports tables, and another completely different version if it does not. The extra indentation is not necessary, but is added for clarity:
<!--.if $HasTables-->
<HTML>
<HEAD>
<TITLE>Title for version with tables</TITLE>
</HEAD>
<BODY>
<P>Your browser supports tables!</P>
</BODY>
</HTML>
<!--.else-->
<HTML>
<HEAD>
<TITLE>Title for version with without tables</TITLE>
</HEAD>
<BODY>
<P>Your browser doesn't support tables.</P>
</BODY>
</HTML>
<!--.endif-->
Of course, the wonderful thing about the way this works is that the extra code never even gets sent to the person reading the document. Not only does he not have to wait for the extra code to download, but he has no way of knowing that you have two versions of the document in this one file.
For other examples using the .IF command,
see the sections on Variables and the .RANDOM
command.
Home | Directories | Web Email | Calendar | Campus Map | Search | Help
About the College |
Admission |
Academics |
Student Life |
Athletics Copyright © 2001 Mount Holyoke College. This page created by the OIS Operations Group and maintained by Webmaster. Last modified on November 2, 2001. |