jQuery实时显示鼠标指针位置和键盘ASCII码
本文通过jquery技术实现鼠标指针位置和键盘ASCII码,代码简单易懂,具体内容请看下文吧。
<!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>
按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>
相关推荐
gaochujia 2020-06-22
qsdnet我想学编程 2019-11-04
teresalxm 2017-07-14
84296033 2015-07-20
fraternityjava 2015-06-17
jltd00 2015-01-27
muyangzhe 2018-06-18
愚盦 2018-05-21
切慕溪水 2017-07-14
DreamLee 2015-04-22
icecoffeemzp 2011-09-18
FloatDreamed 2011-08-17
maoye 2011-06-19
测试极客 2016-09-13