AndieB Posted January 17, 2009 Share Posted January 17, 2009 Hi all, I'd like to create a javascript that changes the background-color of a ROW in a table when moving the mouse pointer over the ROW. I've seen some examples, but these examples have written the background-color values static in each <TR> tag. I want a function that should be called upon. Is it possible to FETCH the current background-color value in the onmouseover function to be used by the onmouseout function, so that the background-color goes back to its origin color? The reason I ask, is because the TABLE itself and the ROWS/CELLS are created with PHP script and in that SCRIPT the background-color value is defined in a STRING. Anyone who can assist me? Thank you in advance! --Andreas Quote Link to comment Share on other sites More sharing options...
Zane Posted January 17, 2009 Share Posted January 17, 2009 You should be able to use the hover pseudo class on the TR tag. for instance in your CSS tr:hover { background-color:white; } you may or may not have some IE problems though, but if you did you could very well use a javascript fix to set the class of the particular TR tag to something else. then you can have tr.over, tr:hover { background-color:white; } Or if you please you could change only the background color. I suggest changing the class though Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.