SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Jan 2002
    0 Post(s)
    0 Thread(s)

    javascript array and td background colors...

    Ihave a forum (ikonboard 3.0.1) I am about to open with several boards on it in a few categories. I have a skin installed that will change the color of the background in the hovered <td> when mouseover'd.

    I was thinking it would be nice if the roll-over on the main forum screen to match the colors we use on the board that that link goes to (we changed the even post color and some other stuff on the idividual boards).

    My thought was to do this:

    Create a javascript array at the top of the main forum page, filled with the colors you want to use for the mouseovers. The array needs to have the same number of elements as the forum has boards. (the problem here are boards that only certain members can see, like admins, which is where some perl code will prolly be required... not sure, but we are not worrying about that yet anyway )

    now, create a javascript var... rowColorCount = 0 say. (That assumes arrays start with element 1 in javascript, vb it starts at 0, if here also, just init it to -1, heh).

    just before the mouse overs, increment the rowColorCount, so as we add rows, we move along through the array.

    now, back at the mouse over, replace:


    in my ASP pages, I have a function to add quotes, single or double, and I assume you can do the same with javascript somehow, if that is needed there.

    as long as you set up the array correctly, it should allow you to do any color roll-over you want in those TDs.

    let me know what you think, and if you need any more info, heh. Thanks for the time,
    welcome, to my web

  2. #2
    SitePoint Guru Vincent Puglia's Avatar
    Join Date
    Feb 2000
    where the World once stood
    0 Post(s)
    0 Thread(s)
    Hi spydah,

    What you want to do -- a mite bit confusing -- but....

    var myColors = new Array();
    myColors[0] = '#292929';
    myColors[1] = '#ff2929';
    myColors[2] = '#29ff29';

    <td onMouseover = "[X]" onMouseout = "[Y]"

    where 'X' and 'Y' are numbers from 0 to (myColors.length - 1)

    If the above is not what you're asking for, you will have be a bit more clearer.

    Where the World Once Stood
    the blades of grass
    cut me still


Posting Permissions

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