| CodeGuru Home | VC++ / MFC / C++ | .NET / C# | Visual Basic | Newsletters | VB Forums | Developer.com |
|
|||||||
| Scripting - Client Side Discuss client-side scripting issues. Client-side scripting such as JavaScript, JScript, and VBScript as well as technologies such as HTML and stylesheets. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
All I want to do is capture the document.onmousemove event - for some reason it is not working - any suggestions? It works fine in IE.
In my <body>: <script language="JavaScript"> document.onmousemove = f_imgBlinkEyes; </script> In my .js: function f_imgBlinkEyes() { /* never gets here */ ...some stuff } |
|
#2
|
|||
|
|||
|
Code:
<!-- Example Written by Zvona -->
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Mouse handling</title>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1;" />
<script type="text/javascript">
oParent = (document.all)?document.documentElement:window;
oParent.captureEvents(Event.MOUSEMOVE);
oParent.onmousemove = zMove;
function zMove(e)
{
mouseX = (document.all)?window.event.x:e.pageX;
mouseY = (document.all)?window.event.y:e.pageY;
window.status = mouseX +" : "+ mouseY;
}
</script>
</head>
<body>
<h2>Example of mouse handling for IE and NS(both Mozilla/Navigator)</h2>
</body>
</html>
__________________
Zvona - First aid for client-side web design Last edited by Zvona; June 24th, 2002 at 06:55 AM. |
|
#3
|
|||
|
|||
|
Do you get any error messages? I would look into setting up your JavaScript console, or a pop up window so you can debug your code. Anyway, it's a pretty easy fix since you are calling the function f_imgBlinkEyes while you have it written as a variable name. Try this...
document.onmousemove = f_imgBlinkEyes(); |
|
#4
|
||||
|
||||
|
Quote:
Trapping mouseevent is really tricky on Netscape version below 6.x. Also not on Event-Bubling, which means if you have an image on your page and your mouse is over that image, the event might not get fired up properly. Post the URL to the page and I can try to take a look at it. -Cool Bizs |
![]() |
| Bookmarks |
|
||||||
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|