assign variable to store table cell info

admin

Administrator
Staff member
Hi,

I have created a table to act as a grid of many small squares, each of which changes colour upon mouseover. To do this I have had to use the following html code.

<tr height = 18>

<td width = 18 bgcolor="#FFFFFF" onMouseOver="this.bgColor='#257F00'" onMouseOut="this.bgColor='#FFFFFF'">&nbsp</td>

<td width = 18 bgcolor="#FFFFFF" onMouseOver="this.bgColor='#257F00'" onMouseOut="this.bgColor='#FFFFFF'">&nbsp</td>


and repeate this over and over for each row (which is very tedious)


How do assign the repetition of .<td width = 18 bgcolor="#FFFFFF" onMouseOver="this.bgColor='#257F00'" onMouseOut="this.bgColor='#FFFFFF'">&nbsp</td> to a variable? And once I have done this, how do I call this variable for use in the table.

Thanks
 
Back
Top