標籤:des style blog color 使用 os
1 Ext.onReady(function(){ 2 var fileUpload = new Ext.FormPanel({ 3 id:‘fileUpload‘, 4 frame:true, 5 fileUpload:true, 6 items:[{ 7 xtype:‘textfield‘, 8 labelStyle : ‘text-align:right;‘, 9 allowBlank:false,10 fieldLabel:‘選擇檔案‘,11 inputType:‘file‘,12 name:‘fileName‘,13 width:20014 }15 ],16 buttonAlign:‘center‘,17 buttons:[{18 text:‘上傳‘,19 handler:function(){20 if(fileUpload.form.isValid()){21 fileUpload.form.submit({22 method:‘post‘,23 url:‘DefaultUrl‘,//根據自己系統的需要調用程式處理上傳檔案24 waitMsg:‘檔案上傳中...‘,25 success: function() {26 Ext.Msg.alert("系統提示", "檔案上傳成功!");27 },28 failure: function() {29 Ext.Msg.alert("系統提示", "檔案上傳失敗!");30 }31 });32 }else{33 Ext.Msg.alert("系統提示","請選擇檔案後再上傳!");34 }35 }36 },{37 text:‘取消‘,38 handler:function(){39 winFielUpload.hide();40 }41 }42 ]43 });44 var winFielUpload=new Ext.Window({45 id:‘win‘,46 title:‘檔案上傳‘,47 //****renderTo:‘divWindow‘,//對於window不要使用renderTo屬性,只需要調用show方法就可以顯示,添加此屬性會難以控制其位置48 width:350,49 closeAction:‘hide‘,//close預設的動作是從DOM樹中移除window並徹底加以銷毀, hide隱藏50 height:105,51 layout:‘fit‘,52 autoDestory:true,53 modal:true,54 closeAction:‘hide‘,55 items:[56 fileUpload57 ]58 }).show();59 });