Îı¾¿òÖУ¬keydown´¥·¢Ê±£¬ÏÈÖ´ÐÐ×Ô¼º¶¨ÒåµÄkeydownʼþ£¬Õâ¸öʱºòÎı¾¿òÀïÃ滹ûÓн«Ä㰴ϵÄÄǸöÖµÊäÈ루»¹Ã»ÓÐÖ´ÐÐĬÈÏʼþ£©£¬ËùÒÔ»áÉÙÒ»¸ö×Öĸ£»µ«ÊÇkeyup²»Ò»Ñù£¬keyupʼþÇ°Òѽ«Ö´ÐÐkeydownĬÈÏʼþ£¬ÒѾ½«Îı¾¿òÄÚÖµ¸üУ¬ËùÒÔ¿´ÆðÀ´keyupÊǼ°Ê±¸üеģ¡
Îı¾¿òÖУ¬keydown´¥·¢Ê±£¬ÏÈÖ´ÐÐ×Ô¼º¶¨ÒåµÄkeydownʼþ£¬Õâ¸öʱºòÎı¾¿òÀïÃ滹ûÓн«Ä㰴ϵÄÄǸöÖµÊäÈ루»¹Ã»ÓÐÖ´ÐÐĬÈÏʼþ£©£¬ËùÒÔ»áÉÙÒ»¸ö×Öĸ£»µ«ÊÇkeyup²»Ò»Ñù£¬keyupʼþÇ°Òѽ«Ö´ÐÐkeydownĬÈÏʼþ£¬ÒѾ½«Îı¾¿òÄÚÖµ¸üУ¬ËùÒÔ¿´ÆðÀ´keyupÊǼ°Ê±¸üеģ¡
ä¯ÀÀÆ÷µÄ½âÎöDOM·½Ê½Ö®Ò» ä¯ÀÀÆ÷½âÎöDOMÖ÷ÒªÓÐÁ½ÖÖ·½Ê½£¬Ã°ÅÝ»úÖƺÍίÍлúÖÆ£¬IEä¯ÀÀÆ÷Ö÷Òª²ÉÓõÄÊÇðÅÝ»úÖÆ£¬¹È¸èÒÔ¼°ÆäËûä¯ÀÀÆ÷Ö÷Òª²ÉÓÃίÍлúÖÆ¡£ ðÅÝ»úÖƼ´£¬×÷ÓÃÓÚDOMÉϵIJÙ×÷»áðÅÝ´«µÝ£¬¾ÍÊÇÏÈ×÷ÓÃÔÚ×î¾ßÌåµÄÔªËØÈ»ºóÏòÉÏðÅÝ£¬¼ÌÐø×÷ÓÃËûµÄ¸¸ÔªËØ£¬µ½×æÔªËØ£¬ÔÙµ½×îºóµÄÕû¸öDOMÎĵµ£¨µ±È»Õâ¸öÊÇ¿ÉÒÔÉèÖÃðÅÝ×èÖ¹µ½ÄǶù£© ίÍлúÖÆÏà·´£¬×÷ÓÃÓÚDOMÉϵIJÙ×÷»á×îÏÈ×÷ÓÃÔÚÕû¸öDOMÎĵµÉÏ£¬È»ºó²Å»áÕÒµ½Ê¼þ×î¾ßÌåµÄÔªËØ¡£
keypressʼþÓëkeydownºÍkeyupµÄÖ÷ÒªÇø±ð Ö»Äܲ¶»ñµ¥¸ö×Ö·û£¬²»Äܲ¶»ñ×éºÏ¼ü ÎÞ·¨ÏìӦϵͳ¹¦Äܼü£¨Èçdelete£¬backspace£© ²»Çø·ÖС¼üÅ̺ÍÖ÷¼üÅ̵ÄÊý×Ö×Ö·û ×ܶøÑÔÖ®£¬ KeyPressÖ÷ÒªÓÃÀ´½ÓÊÕ×Öĸ¡¢Êý×ÖµÈANSI×Ö·û£¬¶ø KeyDown ºÍ KeyUP ʼþ¹ý³Ì¿ÉÒÔ´¦ÀíÈκβ»±» KeyPress ʶ±ðµÄ»÷¼ü¡£ÖîÈ磺¹¦Äܼü£¨F1-F12£©¡¢±à¼¼ü¡¢¶¨Î»¼üÒÔ¼°ÈκÎÕâЩ¼üºÍ¼üÅÌ»»µµ¼üµÄ×éºÏµÈ¡£
mouseenterʼþºÍmouseoverµÄÇø±ð ¹Ø¼üµã¾ÍÊÇ£ºÃ°Åݵķ½Ê½´¦ÀíÎÊÌâ ¼òµ¥µÄÀý×Ó£º mouseoverΪÀý£º <div class="aaron2"> <p>Êó±êÀ뿪´ËÇøÓò´¥·¢mouseleaveʼþ</p> </div> Èç¹ûÔÚpÔªËØÓëdivÔªËض¼°ó¶¨mouseoverʼþ£¬Êó±êÔÚÀ뿪pÔªËØ£¬µ«ÊÇûÓÐÀ뿪divÔªËصÄʱºò£¬´¥·¢µÄ½á¹û: 1.pÔªËØÏìӦʼþ 2.divÔªËØÏìӦʼþ ÕâÀïµÄÎÊÌâÊÇdivΪʲô»á±»´¥·¢£¿ ÔÒò¾ÍÊÇʼþðÅݵÄÎÊÌ⣬pÔªËØ´¥·¢ÁËmouseover£¬Ëû»áÒ»Ö±ÍùÉÏÕÒ¸¸ÔªËØÉϵÄmouseoverʼþ£¬Èç¹û¸¸ÔªËØÓÐmouseoverʼþ¾Í»á±»´¥·¢ ËùÒÔÔÚÕâÖÖÇé¿öÏÂÃ棬jQueryÍƼöÎÒÃÇʹÓà mouseenterʼþ mouseenterʼþÖ»»áÔÚ°ó¶¨ËüµÄÔªËØÉϱ»µ÷Ó㬶ø²»»áÔÚºó´ú½ÚµãÉϱ»´¥·¢
mousedownʼþ´¥·¢ÐèÒªÒÔϼ¸µã£º mousedownÇ¿µ÷ÊÇ°´Ï´¥·¢ Èç¹ûÔÚÒ»¸öÔªËØ°´×¡ÁËÊó±ê²»·Å£¬²¢ÇÒÍ϶¯Êó±êÀ뿪Õâ¸öÔªËØ£¬²¢ÊÍ·ÅÊó±ê¼ü£¬ÕâÈÔÈ»ÊÇËã×÷mousedownʼþ ÈκÎÊó±ê°´Å¥±»°´ÏÂʱ¶¼ÄÜ´¥·¢mousedownʼþ ÓÃevent ¶ÔÏóµÄwhichÇø±ð°´¼ü£¬Çû÷Êó±ê×ó¼üwhichµÄÖµÊÇ1£¬Çû÷Êó±êÖмüwhichµÄÖµÊÇ2£¬Çû÷Êó±êÓÒ¼üwhichµÄÖµÊÇ3 mouseupʼþ´¥·¢ÐèÒªÒÔϼ¸µã£º mouseupÇ¿µ÷ÊÇËÉÊÖ´¥·¢£¬ÓëmousedownÊÇÏà·´µÄ mouseupÓëmousedown×éºÏÆðÀ´¾ÍÊÇclickʼþ Èç¹ûÓû§ÔÚÒ»¸öÔªËØÉÏ°´ÏÂÊó±ê°´¼ü£¬²¢ÇÒÍ϶¯Êó±êÀ뿪Õâ¸öÔªËØ£¬È»ºóÊÍ·ÅÊó±ê¼ü£¬ÕâÈÔÈ»ÊÇËã×÷mouseupʼþ ÈκÎÊó±ê°´Å¥ËÉÊÖʱ¶¼ÄÜ´¥·¢mouseupʼþ ÓÃevent ¶ÔÏóµÄwhichÇø±ð°´¼ü£¬Çû÷Êó±ê×ó¼üwhichµÄÖµÊÇ1£¬Çû÷Êó±êÖмüwhichµÄÖµÊÇ2£¬Çû÷Êó±êÓÒ¼üwhichµÄÖµÊÇ3 ÁíÍâÐèҪעÒâµÄÊÇ£º clickÓëmousedownµÄÇø±ð£º clickʼþÆäʵÊÇÓÉmousedownÓÚmouseup 2¸ö¶¯×÷¹¹³É£¬ËùÒÔµã»÷µÄ¶¯×÷Ö»ÓÐÔÚËÉÊÖºó²Å´¥·¢
ÕâÀïûÓÐÈ¡ÏûʼþðÅÝ¡£ÔÚ±¾ÀýÖУ¬µ±input»ñµÃ½¹µãʱ£¬±Ø¶¨»á²úÉú¡±»ñÈ¡½¹µã¡°Ê¼þ£¬Õâ¸öʼþ´ÓµÍµ½¸ß½øÐÐðÅÝ¡£focusÓëfocusinµÄÇø±ðÔÚÓÚ¿´µ½ ðÅÝÀ´µÄʼþ ÊÇ·ñ´¥·¢¡£ focusin Óöµ½Ã°ÅÝÀ´µÄʼþʱ£¬»á´¥·¢¡£ focusÓöµ½Ã°ÅÝÀ´µÄʼþʱ£¬²»»á´¥·¢¡£Ò²¾ÍÊÇ˵£¬focusÖ»ÓÐÔÚ×Ô¼º²úÉú»ñÈ¡½¹µãʼþʱ²Å´¥·¢¡£
ʼþ¶ÔÏóµÄÊôÓÚÓë·½·¨Óкܶ࣬µ«ÊÇÎÒÃǾ³£ÓõÄÖ»ÓÐÄÇô¼¸¸ö£¬ÕâÀïÎÒÖ÷Ҫ˵ÏÂ×÷ÓÃÓëÇø±ð event.type£º»ñȡʼþµÄÀàÐÍ ´¥·¢ÔªËصÄʼþÀàÐÍ $("a").click(function(event) { alert(event.type); // "click"ʼþ }); event.pageX ºÍ event.pageY£º»ñÈ¡Êó±êµ±Ç°Ïà¶ÔÓÚÒ³ÃæµÄ×ø±ê ͨ¹ýÕâ2¸öÊôÐÔ£¬¿ÉÒÔÈ·¶¨ÔªËØÔÚµ±Ç°Ò³ÃæµÄ×ø±êÖµ£¬Êó±êÏà¶ÔÓÚÎĵµµÄ×ó±ßÔµµÄλÖã¨×ó±ß£©Óë £¨¶¥±ß£©µÄ¾àÀ룬¼òµ¥À´ËµÊÇ´ÓÒ³Ãæ×óÉϽǿªÊ¼,¼´ÊÇÒÔÒ³ÃæΪ²Î¿¼µã,²»Ë滬¶¯ÌõÒƶ¯¶ø±ä»¯ event.preventDefault() ·½·¨£º×èֹĬÈÏÐÐΪ Õâ¸öÓõÄÌرð¶à£¬ÔÚÖ´ÐÐÕâ¸ö·½·¨ºó£¬Èç¹ûµã»÷Ò»¸öÁ´½Ó£¨a±êÇ©£©£¬ä¯ÀÀÆ÷²»»áÌøתµ½Ð嵀 URL È¥ÁË¡£ÎÒÃÇ¿ÉÒÔÓà event.isDefaultPrevented() À´È·¶¨Õâ¸ö·½·¨ÊÇ·ñ(ÔÚÄǸöʼþ¶ÔÏóÉÏ)±»µ÷ÓùýÁË event.stopPropagation() ·½·¨£º×èֹʼþðÅÝ Ê¼þÊÇ¿ÉÒÔðÅݵģ¬Îª·ÀֹʼþðÅݵ½DOMÊ÷ÉÏ£¬Ò²¾ÍÊDz»´¥·¢µÄÈκÎÇ°±²ÔªËØÉϵÄʼþ´¦Àíº¯Êý event.which£º»ñÈ¡ÔÚÊó±êµ¥»÷ʱ£¬µ¥»÷µÄÊÇÊó±êµÄÄĸö¼ü event.which ½« event.keyCode ºÍ event.charCode ±ê×¼»¯ÁË¡£event.whichÒ²½«Õý³£»¯µÄ°´Å¥°´ÏÂ(mousedown ºÍ mouseupevents)£¬×ó¼ü±¨¸æ1£¬Öмä¼ü±¨¸æ2£¬ÓÒ¼ü±¨¸æ3 event.currentTarget : ÔÚʼþðÅݹý³ÌÖеĵ±Ç°DOMÔªËØ Ã°ÅÝÇ°µÄµ±Ç°´¥·¢Ê¼þµÄDOM¶ÔÏó, µÈͬÓÚthis. thisºÍevent.targetµÄÇø±ð£º jsÖÐʼþÊÇ»áðÅݵģ¬ËùÒÔthisÊÇ¿ÉÒԱ仯µÄ£¬µ«event.target²»»á±ä»¯£¬ËüÓÀÔ¶ÊÇÖ±½Ó½ÓÊÜʼþµÄÄ¿±êDOMÔªËØ£» .thisºÍevent.target¶¼ÊÇdom¶ÔÏó Èç¹ûҪʹÓÃjqueyÖеķ½·¨¿ÉÒÔ½«ËûÃÇת»»Îªjquery¶ÔÏó¡£±ÈÈçthisºÍ$(this)µÄʹÓá¢event.targetºÍ$(event.target)µÄʹÓã»
¡¡