SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Mar 2005
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question onmousemove for Firefox

    Hi,

    I am using ASP.Net and simply want to show mouse coords as the user moves their mouse over an image. All is easy with .NET & IE6 but the same script does not run in Firefox. Could some kind souls please tell me how to convert the page below to work with the Firefox browser.

    Do I need to use document.getElementByID ? Are the event mouse properties named differently ? Do I need to enable the MouseMove event ?

    Why is something so simple not within the standards ?

    Bill.


    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <title>WebForm1</title>
    </HEAD>

    <body MS_POSITIONING="GridLayout">
    <form name="Form1" method="post" action="webform1.aspx" id="Form1">

    <script language=JavaScript> function mm() {return window.event.offsetX + "," + window.event.offsetY}</script>


    <img id="Image1" onmousemove="txtMouse.value = mm()" border="0" height="300" width="400" style="Z-INDEX: 101; LEFT: 8px; POSITION: absolute; TOP: 8px" />

    <input name="txtMouse" type="text" id="txtMouse" style="Z-INDEX: 102; LEFT: 72px; POSITION: absolute; TOP: 320px" />

    </form>
    </body>

    </HTML>

  2. #2
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Getting mouse coordinates reliably across browsers isn't too easy. Read up on this quirksmode.org page for some more background info and possibly a solution to your issue.

  3. #3
    I'll take mine raw silver trophy MikeFoster's Avatar
    Join Date
    Dec 2002
    Location
    Alabama, USA
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here's a page where I experiment with properties like this. I just added all position-related properties to the 'native event properties' box.


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
  •