PDA

View Full Version : Whats wrong with this JS code ?


ossama
07-04-2008, 07:13 AM
Hai all,
i am trying to change the raw colors of a table.
whats wrong with this code ?

function loop1(){
document.getElementById('a').bgcolor="#00FFFF";
document.getElementById('b').bgcolor="#FFFFFF";
document.getElementById('c').bgcolor="#00FFFF";
document.getElementById('d').bgcolor="#FFFFFF";
document.getElementById('e').bgcolor="#00FFFF";
}

My table is as follows.

<table width="400" border="0" align="center">
<tr id="a">
<td>&nbsp;</td>
</tr>
<tr id="b">
<td>&nbsp;</td>
</tr>
<tr id="c">
<td>&nbsp;</td>
</tr>
<tr id="d">
<td>&nbsp;</td>
</tr>
<tr id="e">
<td>&nbsp;</td>
</tr>
</table>

abduraooft
07-04-2008, 07:18 AM
It's Object.style.backgroundColor, see http://www.w3schools.com/HTMLDOM/prop_style_backgroundcolor.asp

ossama
07-04-2008, 07:28 AM
Hai abduraoof,

Work like a charm !!!!

BTW, i have to remember this :D

The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep.
-- Dr. APJ. Abdul Kalam

abduraooft
07-04-2008, 07:37 AM
Hows life in Tora-Bora? :D

ossama
07-04-2008, 07:43 AM
Hows life in Tora-Bora? :D

These days very worm. Full time inside the cave. Learning some JS & Ajax for another operation :D

:thumbsup: