<link rel="stylesheet" href="theme-graphite-all.css"> <script src="ext-all.js"></script> <script>Ext.onReady(function () { /*----------------------------------------------------------------------------*/ Ext.create(‘Ext.form.TextField‘, { renderTo: Ext.getBody(), id:‘myTextField‘, }); Ext.get(‘myTextField‘).on(‘keypress‘,function(e){ //监听键盘事件 if(e.charCode==Ext.EventObject.SPACE){ Ext.Msg.alert(‘info‘,‘空格‘); } }); Ext.get(‘myTextField‘).on(‘click‘, function(p){ //处理点击事件代码 document.title="New Title!"; }); }); </script><!------------------------------------------------------------------------------------------------------->
<link rel="stylesheet" href="theme-graphite-all.css"> <script src="ext-all.js"></script> <script>Ext.onReady(function () { /*----------------------------------------------------------------------------*/ Ext.create(‘Ext.form.TextField‘, { renderTo: Ext.getBody(), enableKeyEvents: true, listeners: { keyup: function(src, evt){alert(src.getValue());} } }); }); </script><!------------------------------------------------------------------------------------------------------->