WEB开发网
开发学院网页设计DivCss css多档案上传范例 阅读

css多档案上传范例

 2012-06-30 10:44:24 来源:WEB开发网   
核心提示:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns=&quo
<!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>

Tags:css 档案 上传

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接