Mega Code Archive

 
Categories / JavaScript Tutorial / HTML Tags
 

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> </tr> <tr> <td width="25%">&nbsp;</td> </tr> <tr> <td width="25%">&nbsp;</td> </tr> </table> </body> </html>