Change Table cell background color (IE) : td : HTML Tags JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » HTML Tags » td »

 

Change Table cell background color (IE)

















<html>
<head>
<title>A Simple Page</title>
<script language="JavaScript">
<!--
function chgColor()
{
    var thistag, parentTag;
    thistag = window.event.srcElement.tagName;
    if (thistag == "TD")
    {
        document.all(window.event.srcElement.sourceIndex).bgColor = "lemonchiffon"
    }
}

function chgBack()
{
    var thistag, parentTag;
    thistag = window.event.srcElement.tagName;
    if (thistag == "TD")
    {
        document.all(window.event.srcElement.sourceIndex).bgColor = ""
    }
}
//  -->
</script>
</head>
<body onMouseover="chgColor()" onMouseout="chgBack()">
<table border="1" width="28%">
<tr>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
</tr>
<tr>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
</tr>
<tr>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
</tr>
</table>
</body>
</html>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo HTML Tags
» td