how to change a cell's border colour onClick?

Discussion in 'Javascript' started by ms, Apr 4, 2005.

  1. ms

    ms Guest

    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!
     
    ms, Apr 4, 2005
    #1
    1. Advertisements

  2. ms

    McKirahan Guest

    "backgroundColor" not "backgroundcolor".

    and

    "borderColor" not "bordercolor".
     
    McKirahan, Apr 4, 2005
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.