Jump to content

Hover


Nudua

Recommended Posts

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

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

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

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.

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>

Thank you!
Link to comment
Share on other sites

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

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>

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

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?

Sorry, stupid question :) . It`s just to write in the CSS: td#link {background-color:white}
Link to comment
Share on other sites

Sorry, but now it dosn`t become red on hover... :) HELP!!!

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...