ë¤ì 컨í¸ë¡¤ë¡ ì´ëíë ¤ë©´ Enter í¤ë¥¼ ë르ì¸ì 123 456 [Ctrl A 모ë ì í ì°¸ê³ : ì¸ë¶ J를 ëì í´ì¼ íë ê²½ì° ì¤ííë ¤ë©´ ìë¡ ê³ ì³ì¼ í©ëë¤. ] var elemType;//éä¸æ§ä»¶ç±»å var elemObj; //éä¸æ§ä»¶å¯¹è±¡ function enterKey() { //è·å页é¢æææ§ä»¶ var elems = document.forms[0].elements; var len=elems.length; //设置å车é®è·³è·çæ§ä»¶ç±»å var elemTypeAry =["text","textarea","select-one","button","radio","checkbox"]; var elemTypeStr=elemTypeAry.join(""); for(var i=0;i<len;i++){ //è·åæ§ä»¶ç±»å elemType=elems[i].type; //è¥æ¯å表ä¸çç±»åæ§ä»¶åä¸ºå ¶æ³¨åäºä»¶ if(elemTypeStr.indexOf(elemType)!=-1){ //æ§ä»¶è·å¾ç¦ç¹åä¸ºå ¨å±åéèµå¼ elems[i].onfocus=function(){ //è¥å½åæé®ä¸ºtypeBtnåä¸ä¸ºå ¶æ³¨åonfocusäºä»¶ if(this.id=="typeBtnId")return; //è·å¾å½åæ§ä»¶ç±»å elemType=this.type; //è·å¾å½åæ§ä»¶å¯¹è±¡ elemObj=this; } //è¥æé®ä¸ºEnteråæ¹ä¸ºTabå³è·³å°ä¸ä¸æ§ä»¶ elems[i].onkeydown=function(){ if(event.keyCode==13)event.keyCode=9 }; } } } //æ¾ç¤ºå½åéä¸æ§ä»¶ç±»å function getType(){ alert(elemType); //ç±äºç¹å»æé®åæé®è·å¾ç¦ç¹æéè¦å°ç¦ç¹é置为ä¹åçæ§ä»¶ä¸ elemObj.focus(); }