Change table color every day, not happy with Word

C

Christopher M.

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.
 
B

Barbara de Zoete

I didn't want to have to learn Frontpage, so I've been using Microsoft
Word to edit HTML files.

Well, if you're comfortable with that, fine. But don't expect people who
take markup a lot more serious to take you by the hand and help you step
by step through that bloated mess you think is suitable for the world wide
web.

--
,-- --<--@ -- PretLetters: 'woest wyf', met vele interesses: ----------.
| weblog | http://home.wanadoo.nl/b.de.zoete/_private/weblog.html |
| webontwerp | http://home.wanadoo.nl/b.de.zoete/html/webontwerp.html |
|zweefvliegen | http://home.wanadoo.nl/b.de.zoete/html/vliegen.html |
`-------------------------------------------------- --<--@ ------------'
 
J

Jafar As-Sadiq Calley

I didn't want to have to learn Frontpage, so I've been using Microsoft Word
to edit HTML files.

Below is a link to an easy to follow html tutorial. Learn what is in there
and you'll be producing webpages by hand in notepad faster than any html
bloat generator and it will load faster and be easier to read and debug.

http://www.yourhtmlsource.com/

Failing that, use nvu, mozilla composer or install Linux and use
Quanta+(my fave).
 
A

Alan J. Flavell

Below is a link to an easy to follow html tutorial. [...]
http://www.yourhtmlsource.com/

There's nothing like starting on the wrong foot. It's always so much
harder and time-consuming to un-learn afterwards, if one ever gets serious
about web authoring.

Clue: HTML isn't a visual design language, but a structured markup. Not a
very powerful structure, it's true, but it's still structure. The
stylesheet is meant to look after the visual side of things.

I wish I knew a /good/ beginner tutorial to recommend to folks. This, I'm
afraid, isn't it.

And it refused to fit in my regular browser window - insisting on
throwing a left-right scrollbar, which is rude.
 
P

Paul Watt

Alan J. Flavell said:
Below is a link to an easy to follow html tutorial. [...]
http://www.yourhtmlsource.com/

There's nothing like starting on the wrong foot. It's always so much
harder and time-consuming to un-learn afterwards, if one ever gets serious
about web authoring.

Clue: HTML isn't a visual design language, but a structured markup. Not a
very powerful structure, it's true, but it's still structure. The
stylesheet is meant to look after the visual side of things.

I wish I knew a /good/ beginner tutorial to recommend to folks. This, I'm
afraid, isn't it.

And it refused to fit in my regular browser window - insisting on
throwing a left-right scrollbar, which is rude.

Hi,
Try http://webmonkey.wired.com/webmonkey/ . Theres some great tutorials and
lots of stuff to get you started the right way. All you need is notepad and
a bit of patience.

HTH
Paul
 
D

Dan

Christopher said:
I didn't want to have to learn Frontpage, so I've been using Microsoft Word
to edit HTML files.

I didn't want to have to eat horse shit, so I've been eating chicken
shit. (Clue: There actually *are* alternatives for creating HTML other
than Frontpage and Word, and most of them are better than these pieces
of excrement.)
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.

For a rare change, Word is actually behaving in a quasi-sensible
manner; you're giving it invalid HTML code, so it's trying to fix it
into... well, I won't actually say "valid code", since nothing excreted
from Word has ever validated as far as I'm aware, but it's trying to
fix your error anyway. The code is supposed to be properly structured
and nested *prior to* the execution of any client-side scripting that
may be within it, as well as subsequent to any effects of such editing.
After all, a user may choose to disable JavaScript altogether. Thus,
if you want (for some reason) to output the opening tag of a table via
JavaScript, you ought to output the *entire* table by JavaScript, so
there won't be parts of it present without other parts if the script is
not run.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,736
Latest member
zacharyharris

Latest Threads

Top