站内搜索: 请输入搜索关键词

当前页面: 开发资料首页Javascript 专题对象化JS之----文件上传客户端控制脚本

对象化JS之----文件上传客户端控制脚本

摘要: 对象化JS之----文件上传客户端控制脚本


<script LANGUAGE=javascript>
onload=function(){
var lofile = new upfile();
}

function upfile(aoP){
var loThis = document.createElement("SPAN");
var lsuniqueID = loThis.uniqueID;
loThis.innerHTML = '<select style="width:200"></select><input style="width:10" type="file" onpropertychange="'+lsuniqueID+'.Add(this)">';
if (aoP==null){
document.body.appendChild(loThis);
}else{
aoP.appendChild(loThis);
}
var loSelect = loThis.children[0];
var loFiles = loThis.children[2];
loThis.Add = function(aoFile){
if ((aoFile==null)||(aoFile.value=="")) return;
var loOpts = loSelect.options;
var lsfilename = aoFile.value.substring(aoFile.value.lastIndexOf("\\")+1);
loOpts[loOpts.length] = new Option(lsfilename,aoFile.uniqueID);
loSelect.value = aoFile.uniqueID;
aoFile.parentElement.style.display = "none";
var loObj = document.createElement("span");
loObj.innerHTML = '<input style="width:10" type="file" onpropertychange="'+lsuniqueID+'.Add(this)">';
loFiles.insertBefore(loObj);
}
loThis.Del = function(){
loEL = document.all(loSelect.value);
if (loEL!=null){
loEL = loEL.parentElement;
loFiles.removeChild(loEL);
}
var loOpts = loSelect.options;
if(loOpts!=null&&loOpts.length>0){
loSel = loOpts[loSelect.selectedIndex]
loOpts.removeChild(loSel);
}
}
loThis.AddName = function(asName){
if ((asName==null)||(asName=="")) return;
var loOpts = loSelect.options;
loOpts[loOpts.length] = new Option(asName,null);
}
loThis.getNames = function(){
var loOpts = loSelect.options;
var lxNames = new Array;
for (var i=0; i lxNames[lxNames.length] = loOpts[i].innerText;
}
return lxNames;
}
return loThis;
}
</script>

<script LANGUAGE=javascript> onload=function(){ var lofile = new upfile(); } function upfile(aoP){ var loThis = document.createElement("SPAN"); var lsuniqueID = loThis.uniqueID; loThis.innerHTML = '<select style="width:200"></select><input style="width:10" type="file" onpropertychange="'+lsuniqueID+'.Add(this)">'; if (aoP==null){ document.body.appendChild(loThis); }else{ aoP.appendChild(loThis); } var loSelect = loThis.children[0]; var loFiles = loThis.children[2]; loThis.Add = function(aoFile){ if ((aoFile==null)||(aoFile.value=="")) return; var loOpts = loSelect.options; var lsfilename = aoFile.value.substring(aoFile.value.lastIndexOf("\\")+1); loOpts[loOpts.length] = new Option(lsfilename,aoFile.uniqueID); loSelect.value = aoFile.uniqueID; aoFile.parentElement.style.display = "none"; var loObj = document.createElement("span"); loObj.innerHTML = '<input style="width:10" type="file" onpropertychange="'+lsuniqueID+'.Add(this)">'; loFiles.insertBefore(loObj); } loThis.Del = function(){ loEL = document.all(loSelect.value); if (loEL!=null){ loEL = loEL.parentElement; loFiles.removeChild(loEL); } var loOpts = loSelect.options; if(loOpts!=null&&loOpts.length>0){ loSel = loOpts[loSelect.selectedIndex] loOpts.removeChild(loSel); } } loThis.AddName = function(asName){ if ((asName==null)||(asName=="")) return; var loOpts = loSelect.options; loOpts[loOpts.length] = new Option(asName,null); } loThis.getNames = function(){ var loOpts = loSelect.options; var lxNames = new Array; for (var i=0; i

</td> </tr> <tr> <td vAlign=top align=left height="100%">
↑返回目录
前一篇: 相当于delphi的日历控件
后一篇: 对象化JS之----日期选择