|
Posted by Christopher M. on 09/17/05 08:11
I didn't want to have to learn Frontpage, so I've been using Microsoft Word
to edit HTML files.
I'm using Word 2000, but I'm having a problem. There's a script in my HTML
file that creates a starting TABLE tag. But when I make changes to my HTML
file Word doesn't run the script for the starting TABLE tag, so it gets rid
of the ending TABLE tag.
Here's code for changing the color of your favorite table every day:
<SCRIPT language="JavaScript">
now = new Date()
var dToday = now.getDay()
switch (dToday)
{
// using the 'background' property of the style property to set the
color
// 'bgcolor' property has no effect in this case
// Sunday: Light blue
case 0: document.write('<table border=1 cellspacing=0 cellpadding=0
bgcolor=\"#ffffff\"
style=\'background:#0099FF;border-collapse:collapse;border:none;mso-border-a
lt:solid windowtext .5pt;mso-padding-alt:0in 5.4pt 0in 5.4pt\'>'); break
// Monday: Green
case 1: document.write('<table border=1 cellspacing=0 cellpadding=0
bgcolor=\"#ffffff\"
style=\'background:#00FF00;border-collapse:collapse;border:none;mso-border-a
lt:solid windowtext .5pt;mso-padding-alt:0in 5.4pt 0in 5.4pt\'>'); break
// Tuesday: Blue-Green
case 2: document.write('<table border=1 cellspacing=0 cellpadding=0
bgcolor=\"#ffffff\"
style=\'background:#00FFFF;border-collapse:collapse;border:none;mso-border-a
lt:solid windowtext .5pt;mso-padding-alt:0in 5.4pt 0in 5.4pt\'>'); break
// Wednesday: Off-Red
case 3: document.write('<table border=1 cellspacing=0 cellpadding=0
bgcolor=\"#ffffff\"
style=\'background:#FF6666;border-collapse:collapse;border:none;mso-border-a
lt:solid windowtext .5pt;mso-padding-alt:0in 5.4pt 0in 5.4pt\'>'); break
// Thursday: Red + Blue
case 4: document.write('<table border=1 cellspacing=0 cellpadding=0
bgcolor=\"#ffffff\"
style=\'background:#FF00FF;border-collapse:collapse;border:none;mso-border-a
lt:solid windowtext .5pt;mso-padding-alt:0in 5.4pt 0in 5.4pt\'>'); break
// Friday: Yellow
case 5: document.write('<table border=1 cellspacing=0 cellpadding=0
bgcolor=\"#ffffff\"
style=\'background:#FFFF00;border-collapse:collapse;border:none;mso-border-a
lt:solid windowtext .5pt;mso-padding-alt:0in 5.4pt 0in 5.4pt\'>'); break
// Saturday: Beige
case 6: document.write('<table border=1 cellspacing=0 cellpadding=0
bgcolor=\"#ffffff\"
style=\'background:#FFCC99;border-collapse:collapse;border:none;mso-border-a
lt:solid windowtext .5pt;mso-padding-alt:0in 5.4pt 0in 5.4pt\'>'); break
// Default (in case of error): Beige
default: document.write('<table border=1 cellspacing=0 cellpadding=0
bgcolor=\"#ffffff\"
style=\'background:#FFCC99;border-collapse:collapse;border:none;mso-border-a
lt:solid windowtext .5pt;mso-padding-alt:0in 5.4pt 0in 5.4pt\'>');
}
//code for changing other color properties
//document.bgColor = 'red'
//document.fgColor = 'black'
//document.linkColor = 'blue'
</SCRIPT>
<!commented out the starting tag for the table--generating this above with
Javascript-->
<!--<table border=1 cellspacing=0 cellpadding=0 bgcolor="#ffcc99"
style='background:
#FFCC99;border-collapse:collapse;border:none;mso-border-alt:solid
windowtext .5pt;
mso-padding-alt:0in 5.4pt 0in 5.4pt'>-->
Christopher M.
Navigation:
[Reply to this message]
|