javascript keypressÓëkeydownºÍkeyupµÄÇø±ð
keypressÖ÷ÒªÓÃÀ´½ÓÊÕ×Öĸ¡¢Êý×ÖµÈANSI×Ö·û£¬¶ø keydownºÍ keyupʼþ¹ý³Ì¿ÉÒÔ´¦ÀíÈκβ»±» keypressʶ±ðµÄ»÷¼ü£¬ÖîÈ磺¹¦Äܼü£¨F1-F12£©¡¢±à¼¼ü¡¢¶¨Î»¼üÒÔ¼°ÈκÎÕâЩ¼üºÍ¼üÅÌ»»µµ¼üµÄ×éºÏµÈ¡£Óë
keydownºÍ keyupʼþ²»Í¬µÄÊÇ£¬keypress²»ÏÔʾ¼üÅ̵ÄÎïÀí״̬£¨SHIFT¼ü£©£¬¶øÖ»ÊÇ´«µÝÒ»¸ö×Ö·û¡£keypress½«Ã¿¸ö×Ö·ûµÄ´ó¡¢Ð¡Ð´ÐÎʽ×÷Ϊ²»Í¬µÄ¼ü´úÂë½âÊÍ£¬¼´×÷ΪÁ½ÖÖ²»Í¬µÄ×Ö·û¡£¶ø
keydown
ºÍ keyupÓÃÁ½ÖÖ²ÎÊý½âÊÍÿ¸ö×Ö·ûµÄ´óдÐÎʽºÍСдÐÎʽ£ºkeycode — ÏÔʾÎïÀíµÄ¼ü£¨½« A ºÍ a ×÷Ϊͬһ¸ö¼ü·µ»Ø£©ºÍ shift —ָʾ
shift + key ¼üµÄ״̬¶øÇÒ·µ»Ø A »ò a ÆäÖÐÖ®Ò»¡£
keydown¡¢keyupʼþÊǵ±°´Ï ( keydown) »òËÉ¿ª ( keyup) Ò»¸ö¼üʱ·¢ÉúµÄ¡£ÓÉÓÚÒ»°ã°´Ï¼üÅ̵ļüÍùÍù»áÁ¢¼´·Å¿ª£¨ÕâºÍÊó±ê²»Í¬£©£¬ËùÒÔÕâÁ½¸öʼþʹÓÃÄĸö²î±ð²»´ó¡£
Ïà¹ØÎĵµ£º
Ò»£¬javascriptµÄÄÚ²¿¶ÔÏó£¨Ï൱ÓÚϵͳµ÷Óã¬Æäʵ±¾ÖÊÊÇÒ»¸ö¹¹Ô캯Êý£©
1£¬¶¯Ì¬¶ÔÏó
ʹÓÓ¶ÔÏóʵÀýÃû.³ÉÔ±”µÄ¸ñʽÀ´·ÃÎÊÆäÊôÐԺͷ½·¨¡££¨ÓÃnewÏÈ´´½¨¶ÔÏóʵÀý£©
2£¬¾²Ì¬¶ÔÏó
Ö±½ÓʹÓÓ¶ÔÏóÃû.³ÉÔ±”µÄ¸ñʽÀ´·ÃÎÊÆäÊôÐԺͷ½·¨
¶þ£¬¼¸¸öÄÚÖö ......
ÃæÏò¶ÔÏóµÄ
JavaScript
ÒýÓã¨
reference
£©
“ÒýÓÔÊÇÒ»¸öÖ¸Ïò¶ÔÏóʵ¼ÊλÖõÄÖ¸Õë¡£ÕâÊÇÒ»¸ö¼«ÎªÇ¿´óµÄÌØÐÔ£¬µ«ÓÐÒ»¸öǰÌ᣺ʵ¼ÊµÄ¶ÔÏó¿Ï¶¨²»»áÊÇÒýÓá£×Ö·û´®ÓÀÔ¶ÊÇ×Ö·û´®£¬Êý×éÓÀÔ¶ÊÇÊý×é¡£²»¹ý¶à¸ö±äÁ¿È´Äܹ»Ö¸Ïòͬһ¶ÔÏó¡£
JavaScript
»ùÓڵľÍÊÇÕâÑùÒ»¸öÒýÓÃϵͳ¡£
ÕâÃÅÓïÑÔͨ¹ýά»¤Ò»Ïµ ......
<HTML>
<HEAD>
<META http-equiv='Content-Type' content='text/html; charset=gb2312'>
<TITLE>Óð´Å¥ÏÔʾԴ´úÂë»òÕßjavascriptÀïÃæµÄÄÚÈÝ£¬ÓÐʱ»áÓÐ</TITLE>
</HEAD>
<BODY >
<script id=abc >
function dennisboys()
{
var i=0;
alert(document.documentElem ......
event.srcElement Óëevent.target
Javascript event.srcElement
¸Ð¾õÕâ¸öͦºÃ£¬¿ÉÒÔ²¶»ñµ±Ç°Ê¼þ×÷ÓõĶÔÏó£¬Èçevent.srcElement.tagName¿ÉÒÔ²¶»ñ»î¶¯±ê¼ÇÃû³Æ¡£
×¢Òâ»ñÈ¡µÄ±ê¼Ç¶¼ÒÔ´óд±íʾ£¬Èç"TD","TR","A"µÈ¡£ËùÒÔ°Ñ¿´¹ýµÄһЩ³ÏÂÀ´£¬²»¼ÇµÃµÄʱºòÔÙÀ´¿´¿´¡£
< ......