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 to the CF scene
    Join Date
    Dec 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    event.clientx doesn't work in firefox

    hi -- someone wrote a script for me to simulate an image map on a background header in wordpress. it works great in chrome and ie, but not firefox. can someone pls. help? thx.

    <code>
    <script type="text/javascript">
    function geturl() {
    myMouseX=event.clientX
    if(myMouseX < 400) {
    return "http://www.alexandrazissu.com/az-blog/books/";
    }
    else {
    return "http://www.alexandrazissu.com/az-blog/";
    }
    }
    </script>
    </code>

    and then the call:

    <code>
    <div id="header-image" onclick="location.href = geturl();" style="cursor: pointer;">
    </code>

  • #2
    Senior Coder Dormilich's Avatar
    Join Date
    Jan 2010
    Location
    Behind the Wall
    Posts
    3,350
    Thanks
    13
    Thanked 349 Times in 345 Posts
    I don’t see any reason why firefox should populate the event variable inside the function. for inline JavaScript you have to explicitly pass the event variable (same as the this variable).
    The computer is always right. The computer is always right. The computer is always right. Take it from someone who has programmed for over ten years: not once has the computational mechanism of the machine malfunctioned.
    André Behrens, NY Times Software Developer


  •  

    Tags for this Thread

    Posting Permissions

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