Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to change font color

Status
Not open for further replies.

ptichka

Programmer
May 28, 2002
19
US
Is there any way to change the text color of text inside a table?
I have a function where I use setTimeout(). So every few seconds I want to be able to change the color of the text in my table.

Does anyone have any suggestions for me...please.
 
<script>
function crazy(){
thisTable = document.getElementById(&quot;theTable&quot;)
if (thisTable.style.color == &quot;black&quot;){
thisTable.style.color = &quot;blue&quot;
}
else if (thisTable.style.color == &quot;red&quot;){
thisTable.style.color = &quot;black&quot;
}
else{
thisTable.style.color = &quot;red&quot;
}
setTimeout(&quot;crazy()&quot;,1000)
}
</script>

<body onLoad=&quot;crazy()&quot;>
<table id=&quot;theTable&quot; style=&quot;color: red;&quot;>
<tr><td>First Row</td></tr>
</table> Get the Best Answers! faq333-2924
Is this an asp FAQ? faq333-3048
Tek-Tips Best Practices: FAQ183-3179
 
mwolf00 thanks so much for replying.

The script u gave me works perfect in IE but gives me this error in Netscape :

document.getElementById is not a function.

I have Netscape 4.7. Is it some kind of a bug in 4.7?
 
If you're worried about the very small number of ppl who still use 4.7 read thread216-505911. Get the Best Answers! faq333-2924
Is this an asp FAQ? faq333-3048
Tek-Tips Best Practices: FAQ183-3179
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top