Saturday, December 18, 2010

Getting mouse pointer

 Cut/Copy n Paste

1. please download the latest file :  http://code.jquery.com/jquery-1.4.4.js, save this file as jquery-1.4.4.js

2. Copy the code below and run the html

--------------------

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script src="jquery-1.4.4.js" type="text/javascript"></script>
<script type="text/javascript" >
// find thelocation of mouse and give to div and diplay
jQuery(document).ready(function(){
    jQuery(document).mousemove(function(e){
       jQuery('#status').html(e.pageX +', '+ e.pageY);
   });
})
</script>

</head>

<body>



<h2 id="status">
0, 0
</h2>


</body>
</html>

No comments:

Post a Comment