多档案上传范例

2015-02-24 0 211
多档案上传范例
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"  dir="ltr">
<head>
    <title>input file upload multiple files</title>
</head>
<body>
<input type="file" multiple="" name="filesToUpload" id="filesToUpload" onchange="makeFileList();">
<p>
    <strong>Files You Selected:</strong>
</p>
<ul id="fileList"><li>No Files Selected</li></ul>
<script type="text/javascript">
    function makeFileList(){
        var input = document.getElementById("filesToUpload");
        var ul = document.getElementById("fileList");
        while (ul.hasChildNodes()){
            ul.removeChild(ul.firstChild);
        }
        for(var i = 0; i < input.files.length; i++){
            var li = document.createElement("li");
            li.innerHTML = input.files[i].name;
            ul.appendChild(li);
        }
        if(!ul.hasChildNodes()){
            var li = document.createElement("li");
            li.innerHTML = "No files selected.";
            ul.appendChild(li);
        }
    }
</script>
</body>
</html>

遇见资源网 html 多档案上传范例 http://www.ox520.com/14063.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务