我遇到了这个 html 多文件上传教程:http ://robertnyman.com/2010/12/16/utilizing-the-html5-file-api-to-choose-upload-preview-and-see-progress-for-多文件/
我对网络编程很陌生,以至于无法理解如何从本教程中“完整代码”的两个部分制作代码,基本上是:
A. 一些 html 代码:
<h3>Choose file(s)</h3>
<p>
<input id="files-upload" type="file" multiple>
</p>
<p id="drop-area">
<span class="drop-instructions">or drag and drop files here</span>
<span class="drop-over">Drop files here!</span>
</p>
<ul id="file-list">
<li class="no-items">(no files uploaded yet)</li>
</ul>
B. 还有一些 javascript:
(function () {
var filesUpload = document.getElementById("files-upload"),
dropArea = document.getElementById("drop-area"),
fileList = document.getElementById("file-list");
function uploadFile (file) {
[etc]
我认识代码,但我不明白以 (function () 开头的部分代码应该进入我的代码的位置。
所以我的问题是:javascript 部分应该如何放在我的代码中。
[编辑]
感谢您的补充回答!