PDA

View Full Version : event.clientx doesn't work in firefox



hberk
12-28-2010, 04:15 AM
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>

Dormilich
12-28-2010, 12:09 PM
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).