CodeGuru Forums -
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic Newsletters VB Forums Developer.com


Newest CodeGuru.com Articles:

  • Installing SQL Server 2008
  • Writing UDFs for Firebird Embedded SQL Server
  • [Updated] Shutdown Manager
  • Building Windows Azure Cloud Service Applications with Azure Storage and the Azure SDK

  • Search CodeGuru:
     



    Go Back   CodeGuru Forums > Other Programming > Scripting - Client Side
    FAQ Members List Calendar Search Today's Posts Mark Forums Read

    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.

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1    
    Old June 23rd, 2002, 12:30 PM
    gangelo's Avatar
    gangelo gangelo is offline
    Member
     
    Join Date: May 1999
    Location: New Jersey, USA
    Posts: 369
    gangelo is an unknown quantity at this point (<10)
    Unhappy JavaScript and Netscape Nav. - Why can't I capure the document.onmousemove event?

    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
    }
    Reply With Quote
      #2    
    Old June 24th, 2002, 06:52 AM
    Zvona Zvona is offline
    Member
     
    Join Date: Jan 2002
    Location: Helsinki, Finland
    Posts: 99
    Zvona is an unknown quantity at this point (<10)
    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.
    Reply With Quote
      #3    
    Old June 28th, 2002, 03:56 PM
    spufi spufi is offline
    Junior Member
     
    Join Date: Jun 2002
    Posts: 8
    spufi is an unknown quantity at this point (<10)
    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();
    Reply With Quote
      #4    
    Old June 28th, 2002, 04:41 PM
    coolbiz's Avatar
    coolbiz coolbiz is offline
    Elite Member
     
    Join Date: Feb 2001
    Location: Stamford CT USA
    Posts: 2,162
    coolbiz is on a distinguished road (40+)
    Quote:
    Originally posted by spufi
    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();
    Actually, it should be without the "()" since you're assigning the reference to the function and not executing the function.

    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
    Reply With Quote
    Reply

    Bookmarks
    Go Back   CodeGuru Forums > Other Programming > Scripting - Client Side


    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 12:49 AM.



    Acceptable Use Policy

    internet.comMediabistrojusttechjobs.comGraphics.com

    WebMediaBrands Corporate Info


    Advertise | Newsletters | Feedback | Submit News

    Legal Notices | Licensing | Permissions | Privacy Policy


    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
    Copyright WebMediaBrands Inc. 2002-2009