473,513 Members | 2,263 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2286
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1829
by: Andrew Poulos | last post by:
I'm trying to build a table using DOM methods with script that follows this type of format: // note the var bodyEl is predefined as the body element // var mytable =...
3
4739
by: Peter Williams | last post by:
Hi All, I want to write some javascript for a html page which does the following. Imagine that the page contains a table with 2 columns and 3 rows, e.g.: +---+---+ | A | B | +---+---+
0
1839
by: xprimus | last post by:
Can anyone help me with this, I have a linked image in a tale cell and whenever I click on the image it expands, not only that I have to click on it again to get the link to go. These are the...
4
6076
by: html | last post by:
Hello all, I need to change the colour of my text. For the paragraph I do document.fgColor ="blue" ; but how do I do this for the select tags? ....and I prefer it to apply to all select tags...
0
7265
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7388
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7547
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7114
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5693
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4751
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3240
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3230
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
807
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.