Académique Documents
Professionnel Documents
Culture Documents
White Paper
Table of Contents
Overview....................................................................................................................1
Abstract..................................................................................................................1
Audience.................................................................................................................1
The Design of FrontPage...............................................................................................2
HTML Preservation and Editing...................................................................................2
Chronology of FrontPage HTML Parsing........................................................................3
Strengths of FrontPage 2002.....................................................................................5
HTML Dos and Don'ts Using FrontPage 2002....................................................................6
Web Components and Bots........................................................................................8
Role-based Administration.........................................................................................9
Browser Compatibility...............................................................................................9
HTML on the Clipboard............................................................................................10
Importing HTML from Microsoft Office........................................................................11
SharePoint Team Services.......................................................................................11
Themes and Shared Borders....................................................................................12
Page Margins.........................................................................................................17
Web-style Tables....................................................................................................18
Table and Cell Properties.........................................................................................18
Marquee Web Component........................................................................................20
WordArt and Drawing Tools......................................................................................20
CSS with Netscape Navigator version 4.x...................................................................24
Other Suggestions......................................................................................................25
Preventive: Version-Control Systems.........................................................................25
Formatting............................................................................................................25
Managing Complex Web Pages.................................................................................26
Conclusion................................................................................................................36
The Future of Web Authoring...................................................................................36
HTML Coding Best Practices ....................................................................................36
References................................................................................................................36
Best
Practices Working with HTML Code in
Microsoft FrontPage version 2002
White Paper
Overview
Abstract
Microsoft® FrontPage® version 2002 contains many improvements
to support advanced Web authors better than any previous version
of FrontPage. It preserves unusual HTML constructions, HTML
formatting, ASP scripts, and many other customizations that Web
authors create in their Web pages. Even so, Web authors need to
understand some of the issues regarding customizing HTML by hand
and writing complex Web sites. This paper covers best practices
working with HTML code in FrontPage 2002 including some issues
using FrontPage that affect HTML code and general Web authoring
techniques that can simplify creating complex Web sites.
Audience
This whitepaper should be read by:
Best Practices Working with HTML Code in Microsoft FrontPage version 2002 1
• Experience with authoring Web pages,
This document does not attempt to show the reader how to use
elemental features of FrontPage.
With FrontPage 2000, and more so with FrontPage 2002, all that
changed. FrontPage 2002 is excellent at preserving HTML while
editing. Microsoft worked very hard on FrontPage 2002 to create a
WYSIWYG HTML editor that works as well for experienced authors
as it does for those that do not want to learn HTML in depth. As
always, FrontPage generates proper HTML and it now also
preserves existing HTML very well. It even preserves HTML that
appears to be malformed.
Best Practices Working with HTML Code in Microsoft FrontPage version 2002 2
features. Most would agree, the goal is to create Web sites as
quickly as possible and sometimes that requires directly authoring
HTML.
FrontPage 97
The HTML parser in FrontPage 97 treated HTML files much as a
word processor treats a single document. This design was
consistent with the way all WYSIWYG editors worked at the time.
This design also meshed well with the way many new Web authors
viewed Web pages — as formatted documents resembling desktop
publishing documents.
The file was read and reorganized into a memory structure that was
optimized for editing and rendering. The overall visual layout and
formatting semantics of the initial HTML would be preserved.
However, the actual HTML text, including tag ordering, spacing,
indentation, and so on, was discarded, and the memory structure
was used for editing instead. Whenever FrontPage needed to
recreate the HTML as text, it would do so from this memory
structure.
Best Practices Working with HTML Code in Microsoft FrontPage version 2002 3
script in HTML pages. The presence of server-side script can make
an HTML document appear to have errors to the HTML parser in any
authoring tool.
FrontPage 98
The HTML parser in FrontPage 98 had an important, but subtle
change in behavior. In an effort to preserve the manual
modifications Web authors made, FrontPage 98 preserved the
original tag structure of the HTML. For example, a single <font>
text-level element that surrounded the several <p> block-level
elements would be preserved as is, rather than being replaced with
multiple <font> elements inside each <p> element.
FrontPage 2000
Beginning with FrontPage 2000, FrontPage automatically preserved
the formatting and layout of your existing HTML text, for increased
readability and maintenance because the HTML parser in FrontPage
2000 used a completely new approach. The entire HTML document
was preserved — whitespace, uppercase, lowercase, quoted or
unquoted attributes, line breaks, and so on. Even more, when the
Web author edited the page using the WYSIWYG editor, FrontPage
would attempt to mimic the style of the original HTML.
Best Practices Working with HTML Code in Microsoft FrontPage version 2002 4
Broken HTML was not fixed, except in a few cases. Missing tags and
extra tags were left alone as much as possible. FrontPage 2000
could still add tags in order to place new HTML properly, but it did
not try to balance every element's start and end tags unless
explicitly directed to using the Reformat HTML command. Some
elements were automatically reorganized to get the code to comply
with HTML standards, even though these changes were not required
by many browsers. For example, multiple <body> tags were
consolidated into one <body> element. Children elements of the
<head> element, such as <title>, <meta>, and <style> were
relocated from the <body> element to the <head> element.
Incorrect HTML now was usually left unfixed and the Insert HTML
Markup command could be used to explicitly mark HTML that the
Web author wanted unmodified in any way. Although the contents
or effects HTML inserted this way would not appear in the
WYSIWYG editor, it would be processed in the Preview pane. In
most cases, this Web Component was unnecessary; FrontPage did
not usually remove tags it did not recognize, anyway.
FrontPage 2002
The HTML parser in FrontPage 2002 continues the approach taken
with FrontPage 2000. Now, even complete violations of the HTML
standards are generally left untouched unless the Web author
makes major changes to the document. It can even preserve
multiple <head> and <body> tags. HTML character entities are
preserved better, and the handling of SGML processing instructions,
such as <?IMPORT>, is improved.
Best Practices Working with HTML Code in Microsoft FrontPage version 2002 5
• It implicitly preserves HTML much better than any of its
predecessors did, while still offering the ability to create and edit
proper HTML.
Best Practices Working with HTML Code in Microsoft FrontPage version 2002 6
The following table lists these recommendations.
Best Practices Working with HTML Code in Microsoft FrontPage version 2002 7
CSS with Automatically disabled if Browser
Netscape Compatibility is set correctly.
Navigator 4
Best Practices Working with HTML Code in Microsoft FrontPage version 2002 8
pane of the Web file, then click Properties... on the shortcut
menu.
This article also lists features that require SharePoint Team Services
on the Web server.
Role-based Administration
FrontPage Server Extensions 2002, as used by FrontPage 2002,
introduced a new feature to help administer Web sites, called roles.
Web authors are given an account user name and password. This
account, in turn, has a role assigned to it. These roles provide much
better control over access to features.
Browser Compatibility
FrontPage allows you to target specific browser and Web server
support of various technologies. On the Tools menu, click Page
Options.... This will display the Page Options dialog box. Click the
Compatibility tab. You should see this dialog box:
Best Practices Working with HTML Code in Microsoft FrontPage version 2002 9
Figure 1 — Page Options / Compatibility dialog box
Best Practices Working with HTML Code in Microsoft FrontPage version 2002 10
contents from an Office document, would often paste this extra
information. FrontPage 2002, however, removes most of the
unnecessary information. It also gives you the ability to paste with
a variety of options. When pasting, a Paste Options button
temporarily appears, allowing you to control the formatting of the
pasted text.
Best Practices Working with HTML Code in Microsoft FrontPage version 2002 11
may not recognize HTML files that have these XML namespace
declarations. Even further, they may attempt to display the
contents of the XML elements themselves.
For each file that is to have the theme applied to it, FrontPage adds
a <meta> element to the <head> element of the file. The <meta>
element identifies the theme that should be applied to the page. For
example, applying the Blank theme to a page would insert the
following <meta> tag:
<meta name="Microsoft Theme" content="blank 1011">
As the file is saved, FrontPage applies the theme using either CSS
or additional HTML. If the theme is to be applied using CSS, then
FrontPage adds this <link> element to the line with the <meta> tag,
replacing the text THEME.CSS with the actual file name of the CSS
file for the theme:
<!--mstheme--><link rel="stylesheet" type="text/css"
href="_themes/THEME.CSS">
Best Practices Working with HTML Code in Microsoft FrontPage version 2002 12
to the <body> tag, and script to support the event handler is added
to the <head> element. The rest of the HTML is left unaltered.
For example, let's take a simple HTML file with one paragraph, and
one bulleted list with two items. We'll apply the Blank theme to this
page. In the HTML pane, we see this:
<head>
<meta name="Microsoft Theme" content="blank 1111">
</head>
Best Practices Working with HTML Code in Microsoft FrontPage version 2002 13
<body>
<p>Single paragraph</p>
<ul>
<li>Bullet 1</li>
<li>Bullet 2</li>
</ul>
</body>
The Normal pane of the file reflects the Theme. If we apply the
theme using CSS, FrontPage saves this HTML to the Web server:
<head>
<!--mstheme--><link rel="stylesheet" type="text/css"
href="_themes/blank/blan1011.css"><meta name="Microsoft Theme"
content="blank 1011">
</head>
<body>
<p>Single paragraph</p>
<ul>
<li>Bullet 1</li>
<li>Bullet 2</li>
</ul>
</body>
That's it. No other changes are made to the HTML. Now, let's see
what happens when we apply the theme to the page without using
CSS. The HTML pane of the file does not change in FrontPage, but
the HTML saved to the Web server certainly does!
<head>
<meta name="Microsoft Theme" content="blank 011">
</head>
<body background="_themes/blank/blbkgnd.gif" bgcolor="#FFFFFF"
text="#000000" link="#999999" vlink="#990000"
alink="#666666"><!--mstheme--><font face="Arial, Arial,
Helvetica">
<p>Single paragraph</p>
<!--mstheme--></font><!--msthemelist--><table border="0"
cellpadding="0" cellspacing="0" width="100%">
<!--msthemelist--><tr><td valign="baseline" width="42"><img
src="_themes/blank/ablbull1.gif" width="15" height="15"
hspace="13" alt="bullet"></td><td valign="top" width="100%"><!--
mstheme--><font face="Arial, Arial, Helvetica">Bullet 1<!--
mstheme--></font><!--msthemelist--></td></tr>
<!--msthemelist--><tr><td valign="baseline" width="42"><img
src="_themes/blank/ablbull1.gif" width="15" height="15"
hspace="13" alt="bullet"></td><td valign="top" width="100%"><!--
mstheme--><font face="Arial, Arial, Helvetica">Bullet 2<!--
mstheme--></font><!--msthemelist--></td></tr>
<!--msthemelist--></table><!--mstheme--><font face="Arial,
Arial, Helvetica">
<!--mstheme--></font></body>
Best Practices Working with HTML Code in Microsoft FrontPage version 2002 14
As you can see, quite a lot was added to the original HTML.
With the shared border files in place, FrontPage adds a <meta> tag
to the <head> element. The <meta> tag looks like this:
<meta name="Microsoft Border" content="tlrb">
The letters "tlrb" merely stand for top, left, right, and bottom,
respectively. The presence of each one of these letters indicates
that the page uses the appropriate shared border. If you remove all
shared borders, then the content attribute is assigned the value
"none".
Best Practices Working with HTML Code in Microsoft FrontPage version 2002 15
and one, two, or three columns. The first column is for the left
border if it is present, the second column is for the main body of
the document, and the right border is placed in the third column.
The third table is for the bottom border, if it is present.
Here's a very simple HTML page that uses a top, left, and right
shared border, but not a bottom shared border.
<head>
<meta name="Microsoft Border" content="tlr">
</head>
<body>
<p align="justify">Lorem ipsum dolor sit amet, consectetuer
adipiscing elit.</p>
</body>
When the file is published, the shared borders are expanded. The
shared borders don't need to be stored on the server, though they
might be. The expanded file looks like this:
<head>
<meta name="Microsoft Border" content="tlr">
</head>
<body><!--msnavigation--><table border="0" cellpadding="0"
cellspacing="0" width="100%"><tr><td><p align="center">Top
Border</p>
</td></tr><!--msnavigation--></table><!--msnavigation--><table
dir="ltr" border="0" cellpadding="0" cellspacing="0"
width="100%"><tr><td valign="top" width="1%">
<p>Left<br>Border</p>
</td><td valign="top" width="24"></td><!--msnavigation--><td
valign="top">
<p align="justify">Lorem ipsum dolor sit amet, consectetuer
adipiscing elit. </p>
<!--msnavigation--></td><td valign="top" width="24"></td><td
valign="top" width="1%">
<p>Rightmost<br>Border</p>
</td></tr><!--msnavigation--></table>
</body>
The bolded text in this example represents the table element that
FrontPage added to the file. The italicized text represents the inner
HTML that was extracted from the shared border files and expanded
in this file.
Best Practices Working with HTML Code in Microsoft FrontPage version 2002 16
border file and a closing </div> tag in the right border file. The
results will be unpredictable for most browsers.
Page Margins
The Page Properties dialog, available by selecting the File menu,
Properties... command, has a Margins tab that appears only
under specific conditions. The tab on this dialog box appears only
after you have selected "Microsoft Internet Explorer only" in the
Browsers box of the Page Properties / Compatibility dialog box
(see Figure 1 — Page Options / Compatibility dialog box). If you
select any other browser in the Browsers box, except for the
"Custom" browser setting, then the Margins tab will not appear in
the Page Properties dialog box.
This is important because the way that this dialog sets page
margins does not conform to the HTML specification. Specifically, it
adds topmargin and leftmargin attributes to the <body> element.
The HTML specification does not include margin attributes in the
<body> element tag. See this example:
<body topmargin="0" leftmargin="0">
These changes must be made manually using the HTML pane of the
page editor.
Best Practices Working with HTML Code in Microsoft FrontPage version 2002 17
Web-style Tables
FrontPage 2002 creates tables so that they resemble Microsoft
Word® tables. The border is one pixel thick on all sides, and not
beveled.
Create the table using the Table button on the toolbar or the
Insert Table command.
Make sure the checkbox "Show both cells and table borders"
is checked.
This will remove all the attributes from the <table> tag, and the
table will not resemble a Microsoft Word table, but a web-style
table.
Let's take this example. The following HTML produces a table with
two columns and two rows. It uses the bordercolorlight and
bordercolordark properties in Internet Explorer to change the
highlight and shadow colors of the raised border.
<table border="1" width="100" height="100"
bordercolorlight="lime" bordercolordark="green">
<tr><td> </td><td> </td></tr>
<tr><td> </td><td> </td></tr>
Best Practices Working with HTML Code in Microsoft FrontPage version 2002 18
</table>
As you can see from the following image, the modified table
appears identical to the original.
Best Practices Working with HTML Code in Microsoft FrontPage version 2002 19
Figure 4 — Table using CSS
There are several ways to create moving text without the Marquee
Web Component. Probably the simplest way is to use Dynamic
HTML effects. Also, try researching the FrontPage Add-In Center on
the Web, at
http://www.microsoft.com/frontpage/downloads/addin/default.asp.
Add-Ins can automatically insert scripting or Java applets to
accomplish similar effects.
Best Practices Working with HTML Code in Microsoft FrontPage version 2002 20
VML versus CSS/DHTML positioning
Although VML generally takes fewer bytes to store an image than
many graphic files, it's not an ideal solution for some problems. For
example, let's suppose you want to display a small paragraph of
text in the center of the page, with a tight border around the
paragraph. First, you create the paragraph using line breaks. Then
you select the Outside Border command from the toolbar to put
the border around the paragraph. The borders reach to the left and
right edges of the window, as this illustration shows:
You want the borders closer to the edges of the paragraph, so you
grab the resize handle on the left, and attempt to bring it into the
center of the page. The results are a little surprising — the
paragraph isn't centered at all:
Best Practices Working with HTML Code in Microsoft FrontPage version 2002 21
Figure 7 — Text Box from the Drawing Tools
Unfortunately, the HTML is a little messier. It's correct, but it's hard
to read.
<html xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns="http://www.w3.org/TR/REC-html40">
<link rel="File-List" href="New_Page_1_files/filelist.xml">
<!--[if !mso]>
<style>
v\:* { behavior: url(#default#VML) }
o\:* { behavior: url(#default#VML) }
.shape { behavior: url(#default#VML) }
</style>
<![endif]--><!--[if gte mso 9]>
<xml><o:shapedefaults v:ext="edit" spidmax="1027"/>
</xml><![endif]-->
<body>
<p><v:shapetype id="_x0000_t202"
coordsize="21600,21600" o:spt="202"
path="m,l,21600r21600,l21600,xe">
<v:stroke joinstyle="miter"/>
<v:path gradientshapeok="t" o:connecttype="rect"/>
</v:shapetype><v:shape id="_x0000_s1025" type="#_x0000_t202"
style='position:absolute;
left:131.25pt;top:15pt;width:162.75pt;height:69pt;z-index:1'>
<v:textbox>
<table cellspacing="0" cellpadding="0" width="100%" height="100%">
<tr>
<td align="center">Lorem ipsum dolor sit amet, <br>
consectetuer adipiscing elit, <br>
sed diem nonummy nibh.</td>
</tr>
</table>
</v:textbox>
</v:shape></p>
</body>
</html>
Best Practices Working with HTML Code in Microsoft FrontPage version 2002 22
anywhere we like. Use the Position... command on the Format
menu.
This clearly won't work for more graphical uses of the drawing tools
or WordArt. If you use these features, be prepared to lose some of
the readability in the HTML.
Downlevel Images
For the browsers that do not support VML, the drawing tools and
WordArt will automatically generate a graphic file for the image.
This is called a downlevel image file. Special code in the HTML will
display the VML if the browser supports VML, and the downlevel
image file using an <img> element if the browser does not support
VML.
Often, these files take more bytes than VML, and they don't scale
as well for resizing, which happens when printing. However, if you
are planning to support browsers that do not support VML, turn on
downlevel image file support. Use the Page Options / Compatibility
dialog box, as shown earlier. If you are supporting only VML-
compliant browsers, such as Internet Explorer, then you may want
to disable support for downlevel image support, since it tends to
add complexity to the HTML and takes additional server space.
This example shows the HTML and VML for a single short
paragraph, followed by a yellow circle with a 3-point blue border
and a gray shadow.
Best Practices Working with HTML Code in Microsoft FrontPage version 2002 23
Figure 9 — Yellow circle with blue border and shadow
While this may not seem like much for this small example, it can
make a page with many images difficult to comprehend.
You can avoid this problem by properly selecting the right browsers
in the Page Options / Compatibility dialog box. The only browser
that FrontPage recognizes as correctly supporting CSS is Internet
Explorer.
Best Practices Working with HTML Code in Microsoft FrontPage version 2002 24
Other Suggestions
This section covers some general suggestions for working with
HTML files using FrontPage.
Formatting
Half of knowing what to change in your HTML files lies in knowing
where something needs to be changed. The automatic formatting
commands built into FrontPage can help you make sense of
complex HTML documents. The Reformat HTML and the Apply
XML Formatting Rules commands are on the shortcut menu that
appears when you right-click in the HTML pane.
Best Practices Working with HTML Code in Microsoft FrontPage version 2002 25
Reformat HTML
Using the HTML pane of the FrontPage editor, you can reformat the
HTML in almost any way you like. You can remove all indentation,
or indent every tag, or anything in between. You can specify where
you want line breaks to occur. You can start with a Web page that
is already formatted the way you want, and FrontPage will adjust its
formatting of future HTML pages to match that page.
XML Formatting
The Apply XML Formatting Rules command will create a well-formed
XML document from the Web page, without altering the HTML
layout. It does this by adding end-tags or making self-closing tags
in order to nest the elements properly within a document. It also
changes reserved characters to their equivalent character entities.
The result is a well-formed XML document that is suitable for use in
an XML-enabled application.
Best Practices Working with HTML Code in Microsoft FrontPage version 2002 26
HTML as a Single File
The earliest Web servers were very simple. In response to a
browser's request for a URI, the Web server would merely copy one
entire file into an output buffer and send it to the browser. Web
authors quickly discovered that many Web pages duplicated
common elements across a web. For example, on most Web sites,
every Web page includes a footer, which identifies the owner of the
Web site. The HTML that creates that footer is replicated on every
page.
Best Practices Working with HTML Code in Microsoft FrontPage version 2002 27
<html>
<body>
<p>Main body paragraph.</p>
<!-- #include file="footer.htm" -->
</body>
</html>
The HTML that is sent to the browser looks like the example below.
The extra <html> and <body> tags are in bold:
<html>
<body>
<p>Main body paragraph.</p>
<html>
<body>
<!-- Global footer begin -->
<hr>
<p><font size="2">Common footer</font></p>
<!-- Global footer end -->
</body>
</html>
</body>
</html>
Best Practices Working with HTML Code in Microsoft FrontPage version 2002 28
This example shows an ASP page that uses a common library file to
create a quote of the day:
<!-- #include file="qotd.asp" -->
<p>Main body paragraph.</p>
<hr>
<div style="text-align:center;">
<table style="background:buttonface;">
<tr>
<td style="color:buttontext;font-size:10pt;">
<% Response.Write QuoteOfTheDay(DatePart("y", Date)) %>
</div>
If you look carefully, you'll see something unusual, even if you don't
know VBScript or ASP. The HTML in the first file appears incorrect:
the <table>, <tr>, and <td> start tags should be matched with
ending </td>, </tr>, and </table> tags. However, in the second
file, we see that the QuoteOfTheDay function writes ending
</table>, </tr>, and </td> tags into the response stream, using
the Response.Write method.
When the ASP pages are executed, they do produce correct HTML,
like this:
Best Practices Working with HTML Code in Microsoft FrontPage version 2002 29
<p>Main body paragraph.</p>
<hr>
<div style="text-align:center;">
<table style="background:buttonface;">
<tr>
<td style="color:buttontext;font-size:10pt;">
Energy and persistence conquer all things.
<br>~~Benjamin Franklin
</td>
</tr>
</table>
</div>
While this example is trivial and easily corrected, most Web pages
are far more complex and more difficult to correct. Rather than
depend on FrontPage to try to understand your HTML coding, you
should use a method that software developers use to write complex
computer programs.
Best Practices Working with HTML Code in Microsoft FrontPage version 2002 30
<tr>
<td style="background-color: yellow; width: 1in;">
Today's quote:
</td>
<td style="background-color: silver;">
<% Response.Write QuoteOfTheDay(DatePart("y", Date)) %>
</td>
<td style="background-color: yellow; width: 1in;">
Brought to you by QuoteOfTheDay
</td>
</tr>
</table>
</div>
Instead, we see a table with only two cells; the left cell is yellow
and the right cell, silver. The contents of the cell that should have
been on the right are now displayed below the table, as shown in
this figure:
In this example, the results don't look too bad, but for pages that
are more complicated, they could be disastrous.
Best Practices Working with HTML Code in Microsoft FrontPage version 2002 31
modularized file should not require tags to be created or ended
outside of itself. For example, our QuoteOfTheDay function should
either fully create the entire table, with matching start and end
<table>, <tr>, and <td> tags in the function, or else it should not
write any table tags at all.
If you always wanted the table to have the same appearance, every
time it is used, then you should include the table tags in the
function. In this case, it would also make sense to rename the
function to QuoteOfTheDayTable. On the other hand, if you think
you might want the quote of the day to appear elsewhere, perhaps
not in a table at all, then merely remove the table tags entirely
from the function, and leave it named as it is. This technique should
be applied not only to ASP files, but also to server-side include files,
Web Component Include files, shared border files, and any other
files that are meant to be used within a file to generate a single
HTML document.
Make sure that each HTML file, whether it is meant to be part of the
navigable structure of a Web site or a file that is only included
within other files, contains balanced tags. Better still, make sure
that every HTML file is a whole, complete HTML file, and use the
Include Page Web Component to include other HTML files, rather
than a server-side include.
Best Practices Working with HTML Code in Microsoft FrontPage version 2002 32
<tr><td style="background-color:<%= DayColors(WeekDay(Date,
vbMonday) - 1) %>">
Your IP address is <%= Request.ServerVariables("REMOTE_ADDR")
%><br>
Today is <%= DayColors(WeekDay(Date, vbMonday) - 1) %> day
</td></tr>
</table>
<% Else %>
<p>Today is a weekend</p>
<% End If %>
</body>
Best Practices Working with HTML Code in Microsoft FrontPage version 2002 33
The browser is not Internet Explorer and the day of the week
is a weekday.
The browser is not Internet Explorer and the day of the week
is a weekend.
At each place in the file where the ASP script could branch to one of
the possible paths, separate that path into a function that can be
called by the ASP file. For example, the example page above could
be rewritten using three files. The first file is the core HTML
skeleton, and it uses the Include Page Web Component to include
the second file, which is a library of procedures. The third file is a
reusable HTML snippet that has had its <head> element, <html>
tag, and <body> tag removed.
<!--#include file="options2.asp" -->
<body <%= BodyTagAttributesForBrowsers %>>
<% If IsWeekday Then
Server.Execute "ColorDay.asp"
Else
%>
<p>Today is a weekend</p>
<% End If %>
</body>
Here is options2.asp:
<%
Option Explicit
Dim DayColors
DayColors = Array("red", "green", "blue", "purple", "black")
Function IsIE()
IsIE = (InStr(1, Request.ServerVariables("HTTP_USER_AGENT"),
"MSIE") > 0)
End Function
Function BodyTagAttributesForBrowsers()
If IsIE Then BodyTagAttributesForBrowsers = "topmargin=""0""
leftmargin=""0"""
End Function
Function IsWeekday()
IsWeekday = (WeekDay(Date, vbMonday) < 6)
End Function
Function TodaysColor()
TodaysColor = DayColors(WeekDay(Date, vbMonday) - 1)
End Function
%>
This is ColorDay.asp.:
Best Practices Working with HTML Code in Microsoft FrontPage version 2002 34
<table style="color:white;">
<tr>
<td style="background-color:<%= TodaysColor %>">
Your IP address is <%=
Request.ServerVariables("REMOTE_ADDR") %><br>
Today is <%= TodaysColor %> day
</td>
</tr>
</table>
If you are concerned about performance, then, after you have built
your site this way, measure its performance with testing tools and
isolate the slow pages. It will be very easy to optimize performance
afterwards.
Best Practices Working with HTML Code in Microsoft FrontPage version 2002 35
Conclusion
The Future of Web Authoring
Since FrontPage was introduced, in less than a decade, Web
authoring and Web browsing have already gone through one
revolution, and they stand poised to begin another. XML is
becoming the foundation upon which all text-based content is being
managed and transmitted, and it may soon become the basis for all
communication on the Internet. HTML is merging with XML, into
XHTML, making it simpler to create content that reaches further
and is more compatible with all browsers than ever before.
References
• Editing ASP Files with Microsoft FrontPage 2000.
http://msdn.microsoft.com/library/en-
us/dnfp2kta/html/FP2000ASP.asp.
• FrontPage SDK
http://msdn.microsoft.com/library/en-
us/fpsdk2002/html/GettingStarted_About.asp
Best Practices Working with HTML Code in Microsoft FrontPage version 2002 36
http://msdn.microsoft.com/downloads/default.asp?
url=/downloads/sample.asp?url=/msdn-
files/027/001/710/msdncompositedoc.xml
The information contained in this document represents the current view of Microsoft Corporation on the issues discussed as of the
date of publication. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment
on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information presented after the date of publication.
This White Paper is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, AS TO THE
INFORMATION IN THIS DOCUMENT.
Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright, no part of this
document may be reproduced, stored in or introduced into a retrieval system, or transmitted in any form or by any means (electronic,
mechanical, photocopying, recording, or otherwise), or for any purpose, without the express written permission of Microsoft
Corporation.
Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in
this document. Except as expressly provided in any written license agreement from Microsoft, the furnishing of this document does
not give you any license to these patents, trademarks, copyrights, or other intellectual property.
Microsoft, FrontPage, the Office logo, Visual Basic, Visual InterDev, Visual SourceSafe, and Windows are either registered
trademarks or trademarks of Microsoft Corporation in the United States and/or other countries.
The names of actual companies and products mentioned herein may be the trademarks of their respective owners.
Best Practices Working with HTML Code in Microsoft FrontPage version 2002 37