Extjs小例子

 

1.监听文本框是否已经修改过

  xtype : 'textfield',
  fieldLable : '标题',
  listeners : {
    change : function(field,newValue,oldValue){
alert(newValue+'---'+'oldValue');
         //也可以设置一个标志flag来记录修改的状态
}

2.密码禁止右键和Ctrl键
{ fieldLabel: '密码', name: 'password', allowBlank: false, inputType: 'password',id: 'np_user_password', maxLength:20,enableKeyEvents:true,
            listeners:{
                focus:function()
                { //禁止右键
                    document.body.oncontextmenu = function(){ return false;}
            document.body.onpaste = function(){ return false;}

                }
            }
        }
posted on 2025-09-24 17:16  rainbow727  阅读(8)  评论(0)    收藏  举报