Alternating colours in a table cell

T

Trev

Is there any way to make table cell's bgColor alternate, simulating a
flashing effect?
 
R

Richard Cornford

Trev said:
please elaborate!!!!

An ability to use scripts to apply specific background colors to
individual table cells implies an ability to alternate the colours
used, both sequentially and with time.

Richard.
 
A

ASM

Trev a écrit :
Is there any way to make table cell's bgColor alternate, simulating a
flashing effect?

Arrrghhh ! beurk !

<td id="flashy" style="background:lime">


javascript in head :

onload = function() {
setInterval( function() {
var flsh = document.getElementById('flashy').style;
flsh.background = flsh.background=''? 'yellow' : '';
}, 100);
}
 
T

Trev

Richard said:
An ability to use scripts to apply specific background colors to
individual table cells implies an ability to alternate the colours
used, both sequentially and with time.

Richard.


Is there any way to implement this in Javascript, and if so, how?
I have tried using a while(true) loop using the <td>'s element name and
changing bgColor but the code has a malaise.
 
A

ASM

Richard Cornford a écrit :
An ability to use scripts to apply specific background colors to
individual table cells implies an ability to alternate the colours
used, both sequentially and with time.

Richard.

:)

well seen !
 
T

Trev

Tried it...still some malaise.... :(

<HTML>
<HEAD onload = function() {
setInterval( function() {
var flsh = document.getElementById('flashy').style;
flsh.background = flsh.background=''? 'yellow' : '';
}, 100);
} >

</HEAD>
<BODY>



<table>
<tr><td id="flashy" style="background:lime">whizz</td><td>eggy
xt</td><td>bang</td></tr>
</table>

</BODY>


</HTML>
 
T

Trev

ASM said:
Trev a écrit :

I said in *javascript* ! ...

(in header)

You don't know how to input a script code in a html file ?


Damn, sorry, my mind slipped on a dog turd.
 
A

ASM

Trev a écrit :
By the way, why is onload in the head?

why not ?
Should it be in the body tag:
<body onLoad='function();'> ??

<body
onload="setInterval( function() {
var flsh = document.getElementById('flashy').style;
flsh.background = flsh.background=''? 'yellow' : '';
}, 100);">

not very clean
 
P

PL

Trev said:
Is there any way to make table cell's bgColor alternate, simulating a
flashing effect?


Hi Trev,
If you want some ideas, have a look at my webpage (see below).

Cheers

Paul
 

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,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top