?? upload.js
字號:
function checkImage() {
var imag = document.getElementById('files').value;
if (imag == null || imag == "") {
alert("請選擇要上傳的附件!");
return false;
} else {
var pos = imag.lastIndexOf(".");
var lastname = imag.substring(pos, imag.length)
if (lastname.toLowerCase() == ".exe"
|| lastname.toLowerCase() == ".bat"
|| lastname.toLowerCase() == ".sh"
|| lastname.toLowerCase() == ".so"
|| lastname.toLowerCase() == ".dll") {
alert("您上傳的文件類型為" + lastname + ",附件格式類型不正確!");
return false;
}
}
return true;
}
function createCustomer(imag,idx){
var data=Math.round(Math.random()*10000);
var custAjax=new Ajax.Request(
'/inc/uploadAttr.jsp?idx='+idx+"&file="+imag+"&datas="+data,{
method:'post',
onSuccess:showResponse,
onFailure: function(){ alert('上傳失敗...') }
}
);
}
Ext.onReady(function(){
var win;
var button = Ext.get('up_laod');
button.on('click', function(){
var data=Math.round(Math.random()*10000);
var idx=document.getElementById("attach_root_id").value;
if(!win){
win = new Ext.Window({
el:'hello-win',
layout:'fit',
width:450,
autoScroll:true,
title:'上傳附件資料',
maximizable :true,
height:220,
frame:true,
closeAction:'hide',
plain: true,
items:[{
autoLoad: {url: '/inc/uploadAttr.jsp', params: "idx="+idx+"&data="+data}
}],
buttons: [{
text: '上傳完畢',
handler:function(){
win.hide();
showUpLoadFile(idx);
}
}]
});
win.show();
}else{
win.show();
}
});
});
function showUpLoadFile(root_id){
var data=Math.round(Math.random()*10000);
var custAjax=new Ajax.Request(
'/inc/attachInfo.jsp?idx='+root_id+"&datas="+data,{
method:'post',
onSuccess:showResponse,
onFailure: function(){document.getElementById("attr-div").innerHTML="讀取附件信息失敗!";}
}
);
}
function showResponse(response){
document.getElementById("attr-div").innerHTML=response.responseText;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -