Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 7 of 7
  1. #1
    Junior Member
    Join Date
    Oct 2004
    Posts
    4
    Member #
    7899
    How would one do this, please? Changing background color is a friendly acquaintance for me, but I'm having more than a bit of trouble wrapping my head around this.

    Help and examples are greatly appreciated and are definately good karma.

  2.  

  3. #2
    Member Victor's Avatar
    Join Date
    Jul 2004
    Posts
    54
    Member #
    6614
    Code:
    <script type="text/javascript">
    function newColor(idCell) {
    if (document.all) eval('document.all.'+idCell+'.style.background = "#fff"');
    else eval('document.getElementById("' + idCell + '").style.background = "#fff"');
    }
    
    function backColor(idCell) {
    if (document.all) eval('document.all.'+idCell+'.style.background = "#A3C7E8"');
    else eval('document.getElementById("' + idCell + '").style.background = "#000"');
    }
    </script>
    
    <table id="t1">
    <tr>
    <td>
    <a href="#" onMouseOver="newColor('t1')"
     onMouseOut="backColor('t1')">Click here</a>
    </td>
    </tr>
    </table>

  4. #3
    Junior Member
    Join Date
    Oct 2004
    Posts
    4
    Member #
    7899
    Sorry Victor, I was unclear. I had figured out how to change background color, more or less, but I couldn't figure out how to change a table background picture on rollover. At the bottom of the website is a crowd of people, and they change hue on rollover, ideally. Thank you for the script though, I appreciate the time. That's new code for me; I'd figured it out for css, not java.

    If changing table background image is very difficult or not possible, info on how to make a button with a very custom and large area of change, but a small hit area (where the actual visible button is) would also be welcome.

  5. #4
    Senior Member Fallout's Avatar
    Join Date
    Aug 2003
    Location
    Richmond, Virginia
    Posts
    543
    Member #
    2748
    Code:
    <style>
    table:hover { background-image: url(image.jpg); }
    </style>
    Note that IE won't do anything because it will only recognize "hover" for links (<a> tags).

    edit: I guess you could just tweak the JS above to be "style.background-image" and then make it equal "url(image.jpg)". But thats untested and could be completely wrong.

  6. #5
    Junior Member
    Join Date
    Oct 2004
    Posts
    4
    Member #
    7899
    OK, thanks, Fallout. Much obliged.

  7. #6
    Junior Member
    Join Date
    Oct 2004
    Posts
    4
    Member #
    7899
    Hmm...I tried putting that in an ifthen statement, and of course the comnputer just kind of looked at me strange and then wandered off and did its own thing. As a newbie to any programming aside Actionscript and HTML, I'll need an answer a little less concise, I'm afraid. Thanks, you guys, for your help, I'm just asking the question the wrong way.

  8. #7
    Senior Member Fallout's Avatar
    Join Date
    Aug 2003
    Location
    Richmond, Virginia
    Posts
    543
    Member #
    2748
    Put my code between your <head> tags... For the JS put it in the <head> as well, but only the parts that include <script> to </script>. Just copy the <a> tags provided and change them up to fit your site (in the <body> wherever they are needed)


Remove Ads

Posting Permissions

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

Search tags for this page

button for changing table background

Click on a term to search for related topics.
All times are GMT -6. The time now is 12:09 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com