Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: onMouseDown


Message #1 by KATHLEEN.M.WHALEN@c... on Wed, 27 Jun 2001 12:22:06 -0500


       I am trying to set something up on my page, that's not quite
       working.  I
       have a navigation bar on the left frame that has several
       buttons.  I have
       rollovers setup to change the button images when the mouse is
       passed over
       and out (onMouseOver, onMouseOut).  I want to set it up so that
       once the
       button is clicked the image changes permanently.

       For instance,
       normal state = red button
       mouse over = blue button
       mouse click = green button

       I want the button to remain green until the next button is
       clicked.
       I thought I could use the onMousedown event handler, but this
       doesn't seem
       to be working (or I'm using it incorrectly.)  Can someone check
       my code
       and let me know where it is I am going wrong?  The button image
       only
       changes momentarily.  The onClick event changes the image
       located in Frame
       #2.  I even tried moving my function inside the onClick event,
       but then
       nothing at all happened.

       <a href="#"
               onMouseOver="rollOver('A','images/buttons/blue.gif');"
               onMouseOut="rollOver('A','images/buttons/red.gif');"
               onMouseDown="rollOver('A','images/buttons/green
       button.gif');"
               onClick="doPic('images/glossary/a.gif');">RED BUTTON
       IMAGE GOES
       HERE</A>

       -----------------ROLLEOVER FUNCTION-------
       function rollOver(tagName, fileName) {
               document.images[tagName].src=fileName;
       }

       Kathleen M. Whalen
       U.S. Customs Service
        (xxx) xxx-xxxx
       kathleen.m.whalen@c...


  Return to Index