20.事件类型和鼠标按键的类型,键盘按键
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title></title> <script src="jquery-3.3.1.min.js"></script> <script> $(function () { $(document).click(function (event) { console.log(event.type);//事件类型,click,mouseover... console.log(event.which);//鼠标按键,左1,中2,右3 }).keydown(function (event) { console.log(event.keyCode);//输出的是键盘的编码ASCLL }) }) </script> </head> <body> </body> </html>