var cust_person_file_upload_photoName = new Ext.form.TextField({
name:'photoName',
inputType:'file',
fieldLabel:'上传证件',
id:'src_photoName',
width: 120,
change: function(field, newValue, oldValue){
alert(0);
var img_reg = /\.([jJ][pP][gG]){1}$|\.([jJ][pP][eE][gG]){1}$|\.([gG][iI][fF]){1}$|\.([pP][nN][gG]){1}$|\.([bB][mM][pP]){1}$/
        var url = 'file:///' + Ext.get('src_photoName').dom.value;
        Ext.MessageBox.alert("kkk",Ext.get('src_photoName').dom);
        if (img_reg.test(url)) {
            if (Ext.isIE7) {
                var image = Ext.get('file_imageBrowse').dom;
                image.src = Ext.BLANK_IMAGE_URL;// 覆盖原来的图片
                image.filters
                        .item("DXImageTransform.Microsoft.AlphaImageLoader").src = url;
            } else {
                Ext.get('file_imageBrowse').dom.src = getFullPath(Ext.get('src_photoName').dom);
            }
        }
    }
});

解决方案 »

  1.   

    listeners : {
                 change: function(field, newValue, oldValue){
                      alert(0);
                    }
         }
      

  2.   

    Ext.onReady(function()
    { var cust_person_file_upload_photoName = new Ext.form.TextField({
    name : 'photoName',
    inputType : 'file',
    renderTo : Ext.getBody(),
    fieldLabel : '上传证件',
    id : 'src_photoName',
    width : 120,
    listeners : {
    'change' : function(field, newValue, oldValue)
    {
    alert(0);
    var img_reg = /\.([jJ][pP][gG]){1}$|\.([jJ][pP][eE][gG]){1}$|\.([gG][iI][fF]){1}$|\.([pP][nN][gG]){1}$|\.([bB][mM][pP]){1}$/
    var url = 'file:///' + Ext.get('src_photoName').dom.value;
    Ext.MessageBox.alert("kkk", Ext.get('src_photoName').dom);
    if (img_reg.test(url))
    {
    if (Ext.isIE7)
    {
    var image = Ext.get('file_imageBrowse').dom;
    image.src = Ext.BLANK_IMAGE_URL;// 覆盖原来的图片
    image.filters
    .item("DXImageTransform.Microsoft.AlphaImageLoader").src = url;
    }
    else
    {
    Ext.get('file_imageBrowse').dom.src = getFullPath(Ext
    .get('src_photoName').dom);
    }
    }
    }
    } });
    })