This article uses jquery technology to realize the mouse pointer position and keyboard ASCII code. The code is simple and easy to understand. Please see below for the specific content.
<!DOCTYPE html> <html> <head> <title></title> <meta charset="utf-8" /> <script type="text/javascript" src="js/jquery-2.1.4.js"></script> <script language="javascript" type="text/javascript"> $(function() { $(document).mousemove(function(e) { $("span").html("X:" + e.pageX + "Y:" + e.pageY + "事件" + e.type); //不行 document.write("X:" + e.pageX + "Y:" + e.pageY + "事件" + e.type); }); }); </script> </head> <body> <span></span> </body> </html>
Press A
<!DOCTYPE html> <html> <head> <title></title> <meta charset="utf-8" /> <script type="text/javascript" src="js/jquery-2.1.4.js"></script> <script language="javascript" type="text/javascript"> $(function() { $(document).keydown(function(e) { $('span').html(e.which); }) }); </script> </head> <body> <span></span> </body> </html>
The above content is the jQuery that the editor introduces to you in real-time display of the mouse pointer position and keyboard ASCII code. I hope it will be helpful to everyone. For more knowledge, please pay attention to the official website of Script House. The site has new content updated every day!