Results 1 to 6 of 6

Thread: Not to messy just hard to explain

  1. #1
    Join Date
    Nov 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Lightbulb Not to messy just hard to explain

    Okay guyz! i'm having a problem and it doesn't seem like its that hard. Okay i have a button composed of 3 different pictures in a table. I have other buttons as well and when you click on one of them the button is highlighted navy or dark blue to tell which link you are at. The script works great with onclick and that is what i want it to do. The only thing now is I want to keep this method, but when the page loads i need for the button background to be blue and be able to change to the original color light blue(or 669Aff). So when you load the page you already know where you're at and when you click on another button the backgrounds of the button change. the one you clicked is now navy(or 000066) and the previous button was navy is now 669aff). I hope i didn't make this to complicated. any help is appreciated thanks.


    <style>
    .original { background-color: #669AFF; }
    .linkAt { background-color: #000066; }
    </style>

    <script language="javaScript">

    var prevTable = "";

    function ChangeColor(TableAt){

    if (prevTable != ""){prevTable.className = 'original'}
    ChangeBack = document.getElementById(TableAt);
    ChangeBack.className='linkAt'
    prevTable = ChangeBack;
    }

    </script>

    <table id="t3" class=original onClick="ChangeColor('t3')"(this works it interchanges the colors back and forth, but when the page loads i one to already show the link navy (000066) onLoad="ChangeColor('t3')"(this part doesn't--perhaps there is something else i could use) >

    <tr>
    <td><img src="../img/BulletLeft.gif" border="0"></td>
    <td><a

    href="http://courses.cslab.utpb.edu/current/se44602/iteration3/nestedindex.htm"

    TARGET="menuandmain"><img src="../img/iteration3Button.jpg" alt="iteration3 button"

    width="120" height="40"/></a></td>
    <td><img src="../img/BulletRght.gif" border="0"></td>
    </tr>
    </table>

    if you still don't know what i'm talking about email! sorry about that!!!

  2. #2
    Join Date
    Sep 2006
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I think you have to do ChangeBack.style.className='linkAt'

    Though I am not 100% positive.

  3. #3
    Join Date
    Jun 2006
    Posts
    182
    Thanks
    0
    Thanked 14 Times in 14 Posts

    Default

    Does table support the onload event?

  4. #4
    Join Date
    Nov 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    So with the ChangeBack.style.className='linkAt' do i need another function(or css) in my script or use it on the onload event. I don't know if tables handle the onload event, but i'll get back to you.

  5. #5
    Join Date
    Jun 2006
    Posts
    182
    Thanks
    0
    Thanked 14 Times in 14 Posts

    Default

    Table does not support the onload event. You can put it into your body start tag.

  6. #6
    Join Date
    Nov 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    i've tried that to but it doesn't work. I don't know why.......?

Bookmarks

Posting Permissions

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