By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,576 Members | 1,399 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,576 IT Pros & Developers. It's quick & easy.

Change cell color

P: 60
Why can't i do this:

[HTML]<html>
<body>
<pre><center>
<table border=2><tr><td onmouseover="bgcolor="red"" onclick="bgcolor="blue"" onkeyup="bgcolor="brown"" onkeydown="bgcolor="black"">aaaaaa</td></tr></table>
</center></pre>
</body>
</html>[/HTML]

?????
Jun 13 '07 #1
Share this Question
Share on Google+
5 Replies


epots9
Expert 100+
P: 1,351
[HTML]
<html>
<body>
<pre><center>
<table border=2><tr><td name="cell1" id="cell1" onmouseover="this.style.backgroundColor='red'" onclick="this.style.backgroundColor='blue'" onkeyup="this.style.backgroundColor='brown'" onkeydown="this.style.backgroundColor='black'">aaa aaa</td></tr></table>
</center></pre>
</body>
</html>
[/HTML]

that should do the trick.
Jun 13 '07 #2

P: 1
Hi there, I was looking around with the exact same question and this works to highlight the background of the cell on mouseover, but then does not change back and remains the same. I have put all of the code on the same line but can only assume it gets stuck at the first instruction?
Any help gratefully received!
Jun 13 '07 #3

shoonya
100+
P: 161
Hi there, I was looking around with the exact same question and this works to highlight the background of the cell on mouseover, but then does not change back and remains the same. I have put all of the code on the same line but can only assume it gets stuck at the first instruction?
Any help gratefully received!
it's not sticking
add the onmouseover event handler too

shoonya
Jun 14 '07 #4

acoder
Expert Mod 15k+
P: 16,027
Hi there, I was looking around with the exact same question and this works to highlight the background of the cell on mouseover, but then does not change back and remains the same. I have put all of the code on the same line but can only assume it gets stuck at the first instruction?
Any help gratefully received!
Change it back using onmouseout.
Jun 14 '07 #5

shoonya
100+
P: 161
Change it back using onmouseout.
thnx acoder
i misspelled it but wanted to say same thing :D
Jun 14 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.