Toggle Background image On Click

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mindshare
    New Member
    • Oct 2007
    • 10

    Toggle Background image On Click

    Very new to javascript, I need help with toggling a background gradient image on click command. Can anybody help me with the coding?

    Thanks
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5390

    #2
    hi ...

    please post the code that you have so far ...

    kind regards

    Comment

    • mindshare
      New Member
      • Oct 2007
      • 10

      #3
      i currently don't have any codes. I just started learning javascript.

      Comment

      • gits
        Recognized Expert Moderator Expert
        • May 2007
        • 5390

        #4
        ok ... :) ... so post the html-code where the background image is to be toggled ... and explain when the action should be performed (what to click, when to reset?)

        kind regards

        Comment

        • mindshare
          New Member
          • Oct 2007
          • 10

          #5
          [HTML]<tr class="blue-row-low" onmouseover="hi ghlightblue(thi s)" onmouseout="blu elow(this)" onclick="#">

          <td id="cell-border"><input name="" id="check-box" type="checkbox" dir="ltr" value="" />My Name</td>
          <td id="cell-border">Divisio n</td>
          <td>Manager</td>
          </tr>[/HTML]

          I hope this helps
          Last edited by gits; Dec 17 '07, 08:59 PM. Reason: added code tags

          Comment

          • gits
            Recognized Expert Moderator Expert
            • May 2007
            • 5390

            #6
            ok ... so now ... what should be highlighted, when should it be highlighted, and what's in the regarding style-class? do you have a class for the toggle-state too? in case you have it would be an easier way to toggle :) ... so please post the regarding style definitions and try to create one for the toggle state and tell in detail what has when to be toggled ;)

            kind regards

            Comment

            • mindshare
              New Member
              • Oct 2007
              • 10

              #7
              Code:
              .blue-row-low {
              	background: url(img/lightBlueBkrnd.gif) repeat-x;
              	height: 23px;
              	color: #666666;
              
              .blue-row-hi {
              	background: url(img/dkBlueBkrnd.gif) repeat-x;
              	height: 23px;
              	font-weight: normal;
              	color: #000000;
              is this what you mean

              .blue-row-low is the light blue background gradient and .blue-row-hi is a darker blue gradient backgrond so when you click on it once the darker blue appear and if you click it again the light blue appears.
              Last edited by gits; Dec 17 '07, 09:57 PM. Reason: added code tags

              Comment

              Working...