dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: mouse events help

  1. #1
    Join Date
    Jun 2010
    Posts
    2

    mouse events help

    i am going crazy this is taling way to long can someone help me out i feel i have tried everything

    example...

    <span onmouseover=over('1'); onmouseout=out('1'); onclick=click('1'); id=1 name=1>yoyoyoyo</span>

    <span onmouseover=over('2); onmouseout=out('2'); onclick=click('2'); id=1 name=1>yoyoyoyo</span>

    <span onmouseover=over('3'); onmouseout=out('3'); onclick=click('3'); id=1 name=1>yoyoyoyo</span>

    var hold;

    function over(a){
    document.getElementById(a).style.color='green';
    }
    function out(a){
    document.getElementById(a).style.color='black';
    }
    function click(a){
    hold = a;
    document.getElementById(a).style.color='green';
    }
    i need so when u define hold with click to and then mouseout keep that span green it keeps going back to black even when idefine hold.

    so (if hold != ""){
    i need span ' ' to stay green i hope this makes sense thanks

  2. #2
    Join Date
    May 2006
    Location
    Somewhere behind your screen
    Posts
    1,674
    HTML Code:
    <span onmouseover="over(this)" onmouseout="out(this)" onclick="clk(this)" id="sp_1">yoyoyoyo</span>
    
    <span onmouseover="over(this)" onmouseout="out(this)" onclick="clk(this)" id="sp_2">yoyoyoyo</span>
    
    <span onmouseover="over(this)" onmouseout="out(this)" onclick="clk(this)" id="sp_3">yoyoyoyo</span>

    <script language="javascript" type="text/javascript">
    function over(obj){obj.style.color='green';}

    function out(obj){obj.style.color='black';}

    function clk(obj){obj.style.color='green';}
    </script>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles