471,338 Members | 1,119 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,338 software developers and data experts.

how to change a cell's border colour onClick?

ms
Hi, I've been trying to find a way to change a cell's colour when clicking it.
What I've found so far is to change the background colour by using:
function whenClick(navElm) {
var state1 = '#0000FF';
if(navElm.style.backgroundcolor != state1){
navElm.style.backgroundcolor = state1;
}
}

My problem is, first it does not work when I used <td bgcolor="#00FFFF" id ="s2"
onclick ="whenClick(this)">&nbsp;</td>; second, what I want is to change the
border colour. Could anyone please help me on that?
Thanks a lot!
Jul 23 '05 #1
1 2201
"ms" <s4******@student.uq.edu.au> wrote in message
news:d2***********@bunyip2.cc.uq.edu.au...
Hi, I've been trying to find a way to change a cell's colour when clicking it. What I've found so far is to change the background colour by using:
function whenClick(navElm) {
var state1 = '#0000FF';
if(navElm.style.backgroundcolor != state1){
navElm.style.backgroundcolor = state1;
}
}

My problem is, first it does not work when I used <td bgcolor="#00FFFF" id ="s2" onclick ="whenClick(this)">&nbsp;</td>; second, what I want is to change the border colour. Could anyone please help me on that?
Thanks a lot!


"backgroundColor" not "backgroundcolor".

and

"borderColor" not "bordercolor".
Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Andrew Poulos | last post: by
4 posts views Thread by html | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.