標籤:style java 檔案 width for re
方法一:
在定義的form中添加以下javascript代碼:
{
anchor : ‘95%‘,
xtype: ‘fileuploadfield‘,
id: ‘form-file‘,
emptyText: ‘請選擇‘,
fieldLabel: ‘上傳附件‘,
name: ‘meetingAffix‘,
buttonText: ‘Browse‘
}
單擊Browse按鈕後可以開啟對話方塊,選中檔案後,所選檔案路徑會出現在上傳附件後面的文字框中。
方法二:
在定義的form中添加以下javascript代碼:
{
columnWidth :1,
layout :‘form‘,
bodyStyle :‘padding:10px‘,
defaultType :‘textfield‘,
labelWidth :120,
width :1000,
buttonAlign :‘center‘,
items : [ {
fieldLabel :‘請選擇要上傳的檔案‘,
name :‘fileName‘,
id :‘fileId‘,
anchor :‘95%‘,
allowBlank :false,
inputType :‘file‘
} ]
}
方法三:
給按鈕定義以下javascript函數:
var inputObj=document.createElement(‘input‘)
inputObj.setAttribute(‘id‘,‘_ef‘);
inputObj.setAttribute(‘type‘,‘file‘);
inputObj.setAttribute("style",‘visibility:hidden‘);
document.body.appendChild(inputObj);
inputObj.click();
inputObj.value ;
單擊已經添加函數的按鈕會彈出選擇本地檔案的對話方塊。