umekille78 Posted November 29, 2006 Share Posted November 29, 2006 Hi!!I have used onMouseOver to change images. But my question is if you can change the back ground color on a TR part of a TABLE with a onMouseOver?? If one can do that, can anyone help me with the code? <TR BGCOLOR="WHITE"><A HREF="nr1.html" onMouseOver="document.images[0].src='spelare/bilder/1_liten.JPG';"><TD>Nr 1</TD></A></TR> In the code I cange image[0] but what I want to cange is the BGCOLOR in the TR from "white" to "red"Please help me if you can. Im real new to JavaScript and cant find the code for this problem. Link to comment Share on other sites More sharing options...
aspnetguy Posted November 29, 2006 Share Posted November 29, 2006 you cannot have anything other than <td></td> inside <tr></tr>try something like thisHTML <tr onmouseover="changeColor('#000',this)" onmouseout="changeColor('#fff',this)"> <td>something</td></tr> JS function changeColor(hex,object){ object.style.backgroundColor = hex;} Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now