• javascrpt多文件上传文件


    <HTML>
    <HEAD><TITLE>上传文件</TITLE>
    <SCRIPT language=javascript type=text/javascript>
    <!--
    var RES_BT_DELETE = "删除";
    var isIE = (navigator.userAgent.indexOf("MSIE") != -1);
    var fileIndex = 0;function addFile() {
     var spanId = "filespan";
     var fileId = "uploadfile" + (fileIndex++);
     addInputFile(spanId, fileId);
    }function addInputFile(spanId, fileId) {
     var span = document.getElementById(spanId);
     if (span != null) {
     var divObj = document.createElement("div"), fileObj, delObj;
     divObj.id = fileId;
     if (isIE) {
     fileObj = document.createElement("<input type=file onchange=changeFile(form)>");
     delObj = document.createElement("<input type=button onclick=delInputFile('" + spanId + "','" + fileId + "')>");
     } else {
     fileObj = document.createElement("input");
     fileObj.type = "file";
     fileObj.setAttribute("onchange", "changeFile(form)", 0);
     delObj = document.createElement("input");
     delObj.type = "button";
     delObj.setAttribute("onclick", "delInputFile('" + spanId + "','" + fileId + "')", 0);
     }
     fileObj.name = fileId;
     fileObj.size = "40";
     fileObj.className = "input";
     delObj.value = RES_BT_DELETE;
     divObj.appendChild(fileObj);
     divObj.appendChild(document.createTextNode(" "));
     divObj.appendChild(delObj);
     span.appendChild(divObj);
     }
    }function delInputFile(spanId, fileId) {
     var span = document.getElementById(spanId);
     var divObj = document.getElementById(fileId);
     if (span != null && divObj != null) {
     span.removeChild(divObj);
     }
    }
    //-->
    </SCRIPT>
    <META content="MSHTML 6.00.2800.1528" name=GENERATOR>
    </HEAD>
    <BODY class=pagebackground>
    <FORM id=form action=XXX method=post encType=multipart/form-data>
    <TABLE class=dialog1 height=20 cellSpacing=1 cellPadding=8 width="90%" align=center>
     <TBODY>
     <TR>
     <TD noWrap>通过文件上传: </TD>
     <TD id=filespan noWrap>
     <INPUT class=input type=file size=40 name=file>
     <INPUT id=btnAdd onclick=addFile() type=button value=添加>
     </TD>
     </TR>
     </TBODY>
    </TABLE>
    </FORM>
    </BODY></HTML>
  • 相关阅读:
    odoo开发笔记 -- 异常、错误、警告、提示、确认信息显示
    odoo开发笔记--前端搜索视图--按照时间条件筛选
    odoo开发笔记-自定义发送邮件模板
    html表格导出Excel的一点经验心得
    throw和throw ex的区别
    js中对String去空格
    根据不同的多语言环境来切换不同的页面样式的具体示例
    HTML中 :after和:before的作用及使用方法(转)
    CSS清除浮动方法集合
    页面的Tab选项卡 简单实例
  • 原文地址:https://www.cnblogs.com/winner/p/340157.html
Copyright © 2020-2023  润新知