SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict Garrett's Avatar
    Join Date
    Feb 2001
    Location
    England
    Posts
    352
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    table rollover effect

    Hello

    using this script which i found here to do a rollover effect in a table cell


    -- the script

    <script language="Javascript" type="text/javascript">
    function setCellBGcolor(id,color) {
    var c = document.getElementById ? document.getElementById(id) :
    document.all ? document.all[id] :
    document.layers ? document[id+'Outer'].document[id+'Inner'] : null;
    if (document.layers) {
    c.background.src = '';
    c.bgColor = color;
    } else {
    alert ('frames');
    c.style.background = '';
    c.style.backgroundColor = color;
    }
    }
    </script>


    --the rollover

    <td id="cell1" width="200" height="100" bgcolor="#FFFFFF">
    <ilayer id="cell1Outer">
    <layer id="cell1Inner" width="200" height="100"><a href="java script:void(0);" onMouseOut="setCellBGcolor('cell1','#000000')" onMouseOver="setCellBGcolor('cell1','#cc0000')">cell1</a></layer>
    </ilayer>
    </td>



    in fact it uses the table cell or a layer depending on what are the browser capabilities, now in fact what i want to do looks like this (copy and paste the following)...

    <table width="100" border="0" cellspacing="1" cellpadding="0" height="100" bgcolor="cfcfcf" name="table1">
    <tr>
    <td align="right" valign="bottom" bgcolor="#FFFFFF"></td>
    </tr>
    </table>

    a table with bgcolor grey and one cell with bgcolor white so its just an outlined table with a very thin line (thinner than if you use border on the table). I want my rollover to change the bgcolor of the table! i know this limits me to one celled tables for that rollover effect to work, however if i need to use multi-celled tables is there an alternative ie can i access the cell border? and will it give me an outline as thin?

    failing that the layer effect version works fine in ie 5 and ns 4.5 so normally thats thats my aim, can some one show me how i can do the border effect on the layer?

    Sorry for the question being a bit twisted and complex, but i would much appreciate any help given!

    a+
    Garrett

  2. #2
    Sports Publisher mjames's Avatar
    Join Date
    Jan 2000
    Location
    Charlotte, NC
    Posts
    5,891
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not sure the answer to your question. Where did you get the script from? Do you have an example of where this script is on your page?

  3. #3
    SitePoint Addict Garrett's Avatar
    Join Date
    Feb 2001
    Location
    England
    Posts
    352
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    solved this ages ago, thanks anyway!

    a+
    Garrett


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
  •