Nudua Posted February 18, 2006 Share Posted February 18, 2006 Hello.Is it possible to make a td in a table shange color when you hold the mouse over/hover or something. I have made it with links, but I didn`t make it with tables. Can somebody please send the code for it? Link to comment Share on other sites More sharing options...
boen_robot Posted February 18, 2006 Share Posted February 18, 2006 The code is the same as with the links(exept for the selector of course). The only problem is that IE doesn't support :hover on anything else besides links. Sorry. Link to comment Share on other sites More sharing options...
scott100 Posted February 18, 2006 Share Posted February 18, 2006 Where there's a problem there's a JavaScript solution The code below should explain itself. <table border="1" width="50%"><tr><td onmouseover='this.bgColor="red"' onmouseout='this.bgColor="white"'>Red</td><td onmouseover='this.bgColor="blue"' onmouseout='this.bgColor="white"'>Blue</td></tr><tr><td onmouseover='this.bgColor="green"' onmouseout='this.bgColor="white"'>Green</td><td onmouseover='this.bgColor="yellow"' onmouseout='this.bgColor="white"'>Yellow</td></tr></table> Link to comment Share on other sites More sharing options...
Nudua Posted February 18, 2006 Author Share Posted February 18, 2006 The code is the same as with the links(exept for the selector of course). The only problem is that IE doesn't support :hover on anything else besides links. Sorry.<{POST_SNAPBACK}> Why doesnt IE support that? It`s the biggest browser after all...Where there's a problem there's a JavaScript solution The code below should explain itself.<table border="1" width="50%"><tr><td onmouseover='this.bgColor="red"' onmouseout='this.bgColor="white"'>Red</td><td onmouseover='this.bgColor="blue"' onmouseout='this.bgColor="white"'>Blue</td></tr><tr><td onmouseover='this.bgColor="green"' onmouseout='this.bgColor="white"'>Green</td><td onmouseover='this.bgColor="yellow"' onmouseout='this.bgColor="white"'>Yellow</td></tr></table> <{POST_SNAPBACK}> Thank you! Link to comment Share on other sites More sharing options...
boen_robot Posted February 18, 2006 Share Posted February 18, 2006 Why doesnt IE support that? It`s the biggest browser after all... It may be the biggest in terms of "the biggest company owner", but it's also the least supported one. Firefox has updates every few weeks(or monts? I'm not sure...) and IE has one every few years. Also, Mozzila are not afraid to add new things. Microsoft are afraid that old sites may start looking bad, people who use Firefox will increase, and they will lose the browser war forever (imagine a Windows with integrated Firefox in it ). Link to comment Share on other sites More sharing options...
Nudua Posted February 18, 2006 Author Share Posted February 18, 2006 Where there's a problem there's a JavaScript solution The code below should explain itself.<table border="1" width="50%"><tr><td onmouseover='this.bgColor="red"' onmouseout='this.bgColor="white"'>Red</td><td onmouseover='this.bgColor="blue"' onmouseout='this.bgColor="white"'>Blue</td></tr><tr><td onmouseover='this.bgColor="green"' onmouseout='this.bgColor="white"'>Green</td><td onmouseover='this.bgColor="yellow"' onmouseout='this.bgColor="white"'>Yellow</td></tr></table> <{POST_SNAPBACK}> Well, I hadn`t time to test it before now, and now I realise that the backgroundcolor doesn`t shange to white before the mouse has been over it. Is it possible that the background always is white exept on hover? Link to comment Share on other sites More sharing options...
Nudua Posted February 18, 2006 Author Share Posted February 18, 2006 Well, I hadn`t time to test it before now, and now I realise that the backgroundcolor doesn`t shange to white before the mouse has been over it. Is it possible that the background always is white exept on hover?<{POST_SNAPBACK}> Sorry, stupid question . It`s just to write in the CSS: td#link {background-color:white} Link to comment Share on other sites More sharing options...
Nudua Posted February 18, 2006 Author Share Posted February 18, 2006 Sorry, stupid question . It`s just to write in the CSS: td#link {background-color:white}<{POST_SNAPBACK}> Sorry, but now it dosn`t become red on hover... HELP!!! Link to comment Share on other sites More sharing options...
scott100 Posted February 18, 2006 Share Posted February 18, 2006 Sorry, but now it dosn`t become red on hover... HELP!!!<{POST_SNAPBACK}> This code sets the page with a different background colour and the table is always white except on mouseover, is that what you need? <body style="background:black"><table style="background:white" border="1" width="50%"><tr><td onmouseover='this.bgColor="red"' onmouseout='this.bgColor="white"'>Red</td><td onmouseover='this.bgColor="blue"' onmouseout='this.bgColor="white"'>Blue</td></tr><tr><td onmouseover='this.bgColor="green"' onmouseout='this.bgColor="white"'>Green</td><td onmouseover='this.bgColor="yellow"' onmouseout='this.bgColor="white"'>Yellow</td></tr></table> Link to comment Share on other sites More sharing options...
Nudua Posted February 18, 2006 Author Share Posted February 18, 2006 Yes thanks, now it works...I only needed to change the td#link {background-color: white} to table#link {background-color: white} 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