Results 1 to 3 of 3

Thread: change element

  1. #1

    Thread Starter
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945

    change element

    I have a bunch of table rows and I want to change the color of the rows on a mouse over and change it back on the onmouseout... I have that much working. Now I have a function which, when you click on a row, it sets the color of a row to a different color. Problem is, because of the mouseout, it changes it back to the original color as soon as I move away again.

    I wrote this:
    Code:
    function checkchange(el)
    {
        var dael = document.getElementById(el);
        alert(dael);
        /*if(dael.style.bgColor != 'white');
            dael.style.bgColor = '#DDDDDD');*/
    }
    But I can't seem to get it to work. I'm sending the id of the row in the onmouseout call. What am I doing wrong?

    Tell me if you need to see more of the code.
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  2. #2
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246
    You should set a flag.
    Pseudo code:
    Code:
    var cell[x][y] = 0;
    if clicked {
    cell[x][y]=1
    }
    function onmouseout() {
    if cell[x][y]!=1 {
    (set original cell color)
    }
    }
    ..kinda thing. Know what I mean?

    Phreak

    Visual Studio 6, Visual Studio.NET 2005, MASM

  3. #3
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    I usually do
    (In the mouseover):
    Code:
    dael.oldclr = dael.style.backgroundColor;
    dael.style.backgroundColor = highClr;
    (In the mouseout):
    Code:
    dael.style.backgroundColor = dael.oldclr;
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width