SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Member
    Join Date
    Oct 2011
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help! different between onmousemove & onMouseover

    hi
    how r u ?

    i have button, and i used both " onmousemove & onMouseover "
    each one call special function , but they call finction at the same time @@
    i want when i move over the button , user can see this text " Mouse is Over". however, he can see this text "Mouse is Mover" when move.

    " onmousemove ="OnMove();" onMouseover ="OnOver();"
    PHP Code:
    OnMove()
    {
    alert "Mouse is move");
    }

    OnOver()
    {
    alert "Mouse is Over");


  2. #2
    SitePoint Member
    Join Date
    Oct 2011
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Also i wanna make more control of the mouse movement over the button ,,
    for example
    if the mouse move to right i want text " move to right"
    it the mouse move to left i want text "move to left"

  3. #3
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Portsmouth UK
    Posts
    1,497
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    
    <head>
      <title></title>
    <script type="text/javascript">
    /*<![CDATA[*/
    
    function mse(e,obj){
      var lft=e.pageX;
      if (window.event){
       lft=e.clientX+document.documentElement.scrollLeft;
      }
    document.Show.Show0.value=lft>obj.offsetWidth/2?'right':'left';
    
     }
    
    
    /*]]>*/
    </script></head>
    
    <body>
    <input type="button" name="" value="Mouse Move Button" onmousemove="mse(event,this);"/>
    <script> vic=0; </script>
    <form name=Show id=Show style="position:absolute;visibility:visible;top:700px;left:0px;" >
    <input size=100 name=Show0 >
    <input size=10 name=Show1 >
    <input size=10 name=Show2 >
    <input size=10 name=Show3 >
    <input size=10 name=Show4 >
    <input size=10 name=Show5 >
    <input size=10 name=Show6 >
    <input size=10 name=Show7 >
    <input size=10 name=Show8 >
    <input size=10 name=Show9 ><br>
    <textarea name=TA rows=1 cols=100 ></textarea>
    </form>
    </body>
    
    </html>

  4. #4
    SitePoint Member
    Join Date
    Oct 2011
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thank u

    but i want the movment be free
    i mean when user move in any place in the button or any object, u c txt " right" and if change to left , directlly u c "left

    i want some thing control on the mouse pointer

    coz i wanna do some effect if the mouse movement go to right , and i don't do any thing if mouse movement go to left

  5. #5
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,810
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    You need to test the current mouse position and compare it to the position when the move was first triggered.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  6. #6
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Portsmouth UK
    Posts
    1,497
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    
    <head>
      <title></title>
    <script type="text/javascript">
    /*<![CDATA[*/
    
    function mse(e,obj){
      var lft=e.pageX;
      if (window.event){
       lft=e.clientX+document.documentElement.scrollLeft;
      }
      if (!obj.lft){
       obj.lft=lft;
      }
      if (Math.abs(obj.lft-lft)>0){
    document.Show.Show0.value=lft>=obj.lft?'right':'left';
      }
      obj.lft=lft;
     }
    
    
    /*]]>*/
    </script></head>
    
    <body>
    <input type="button" name="" value="Mouse Move Button" onmousemove="mse(event,this);"/>
    <script> vic=0; </script>
    <form name=Show id=Show style="position:absolute;visibility:visible;top:700px;left:0px;" >
    <input size=100 name=Show0 >
    <input size=10 name=Show1 >
    <input size=10 name=Show2 >
    <input size=10 name=Show3 >
    <input size=10 name=Show4 >
    <input size=10 name=Show5 >
    <input size=10 name=Show6 >
    <input size=10 name=Show7 >
    <input size=10 name=Show8 >
    <input size=10 name=Show9 ><br>
    <textarea name=TA rows=1 cols=100 ></textarea>
    </form>
    </body>
    
    </html>

  7. #7
    SitePoint Member
    Join Date
    Oct 2011
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hey
    thanks for ur help ,
    i have tried but haven't done

    function mse(e,obj){

    var lft=e.pageX;
    if (window.event){
    lft=e.clientX+document.documentElement.scrollLeft;

    if(lft>obj.offsetWidth*2.5){
    alert("rightttt")
    collapse2(obj);

    expand3(obj);
    //alert("right3333333ttt")

    }else {
    alert("left");
    expand2(obj);
    }
    }
    }

  8. #8
    SitePoint Member
    Join Date
    Oct 2011
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vwphillips

    thank u
    thank u
    thank u
    reallllllyyyyy thanksssssssssssssssss


Bookmarks

Posting Permissions

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