我一直在試圖以動態加載的格式實現一些文件上傳軟件包(raw php),其中一個頁面上的潛在未知數目。我基本上都是從閃存基礎上看待所有流行的閃存,但它們之間存在相同的問題。文件上傳 - 多個實例
我正在嘗試使用this。
我已經嘗試過使用過的技巧,例如使用^=
在getelementbyid
和"\\S*"
以確保JavaScript使用相關的div id,但我沒有成功。我也嘗試給每個div添加一個類名,並使用getelementbyclass而沒有成功。我已經搜索了一個解決方案,但我只是沒有得到它。
要麼我做錯了,要麼我完全失去了......我其實都是!
如果任何人都可以讓我擺脫不幸的困境,或者讓我朝着正確的方向發展,我會非常感激,因爲我一直在尋找解決方案。
的HTML部分被呈現像這樣:
<p id="upload" class="hidden"><label>Drag & drop not supported, but you can still upload via this input field:<br><input type="file"></label></p>
<p id="filereader">File API & FileReader API not supported</p>
<p id="formdata">XHR2's FormData is not supported</p>
<p id="progress">XHR2's upload progress isn't supported</p>
<p>Upload progress: <progress id="uploadprogress" min="0" max="100" value="0">0</progress></p>
<p>Drag an image from your desktop on to the drop zone above to see the browser both render the preview, but also upload automatically to this server.</p>
我打算通過PHP動態生成它成類似,其中$ INC是一個PHP變量在一個循環中,例如,ID =「的FileReader $ INC
的問題,我相信在這裏的JavaScript將只處理預定義或上傳的一個實例,直到修改,否則
如:的FileReader:的document.getElementById(「的FileReader」)
你能張貼somecode,瞭解問題更好一點? – 2013-04-07 08:17:38
嗯,似乎無法發佈超過500個字符在這裏,但與我試圖使用的代碼鏈接在這裏:http://nghiadh.info/blog/html5-drag-and-drop-and- xhr-upload-34.html – 2013-04-07 08:49:35
問題是我想動態創建html div id,但javascript只能用於一個實例,例如filereader:document.getElementById('filereader')...我需要實現像filereader:document.getElementById('filereader *')如果你知道我的意思嗎? – 2013-04-07 08:53:49