如题,
当我按下Backspace键的时候调用。
specialkey()这个怎么用。。。。
不太懂。。求大神解答
------解决方案--------------------
坐等 hookee 来解决
------解决方案--------------------
Backspace 并不属于 specialkey
用keydown侦听
- HTML code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <link rel="stylesheet" type="text/css" href="extjs/resources/css/ext-all.css" /> <script type="text/javascript" src="extjs/adapter/ext/ext-base.js"></script> <script type="text/javascript" src="extjs/ext-all.js"></script> <script> Ext.onReady(function(){ oForm = new Ext.FormPanel({ renderTo:"form_panel", layout:"form", hideLabels:false, border:false, items:[ {fieldLabel:'性别',enableKeyEvents:true,id:'sel_gender',name:'sel_gender',xtype:'combo',store:[[0,'女'],[1,'男']],editable:false,hiddenName:'gender',forceSelection:true,mode:'local',triggerAction:'all',value:'1', listeners:{ keydown:function(obj, e){ if(e.getKey()==8){ alert("ok"); e.stopEvent(); return false; } } } } ] }); Ext.getCmp('sel_gender').focus(); }); </script> <div id="form_panel"></div>