Javascript mousemove

Javascript mousemove

addEvent(window,'load',changeVal,false);

function changeVal() {
	if (!document.getElementById) return;
   var thisInput = document.getElementById('theInput');
   thisInput.onmousemove = function (evt) {
		evt = (evt) ? evt : ((window.event) ? window.event : "");
		var elem = (evt.target) ? evt.target : evt.srcElement;
      var thisBox = document.getElementById('thisBox');
      thisBox.innerHTML = 'pageX ' + evt.pageX 
                       + ' pageY ' + evt.pageY 
                       + ' clientX ' + evt.clientX 
                       + ' clientY ' + evt.clientY 
                       + ' und Sie halten ' + evt.button;
   }
}
<div id="theInput"></div>
<p id="thisBox"></p>
This entry was posted in Code Snippets. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s