Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Mar 2003
    Posts
    64
    Thanks
    0
    Thanked 0 Times in 0 Posts

    avoiding onMouseover when onClick

    Calling these functions within <td>

    function over(){
    window.event.srcElement.style.color = 'black';
    }
    function out(){
    window.event.srcElement.style.color = 'gray';
    }
    function click(){
    window.event.srcElement.style.color = 'black';
    }

    The default color of the text in a <td> is gray. When onClick, the text is black, but because the out() function is also called in the <td>, the text turns back to gray as soon as the mouse moves out. Any way to make the text remain black when clicked? Thanks.

  • #2
    Regular Coder
    Join Date
    Sep 2002
    Location
    Louisiana
    Posts
    576
    Thanks
    0
    Thanked 0 Times in 0 Posts
    you could remove the commands to change the style when clicking, like this

    Code:
    function over(){
    window.event.srcElement.style.color = 'black';
    }
    function out(){
    window.event.srcElement.style.color = 'gray';
    }
    function click(){
    window.event.srcElement.onMouseOut = "";
    window.event.srcElement.style.color = 'black';
    }


  •  

    Posting Permissions

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