// Closure to capture the file information.
reader.onload = (function(theFile) {
return function(e) {
// Render thumbnail.
var span = document.createElement('span');
span.innerHTML = ['<img class="thumb" src="', e.target.result,
'" title="', escape(theFile.name), '"/>'].join('');
document.getElementById('list' + filesId).insertBefore(span, null);
};
})(f);
我想在此脚本中添加“全部清除”按钮。我使用html(“”)来清空笔记。我还是无法重新上传照片。它存放在哪里?以及如何清除它?
答案 0 :(得分:0)
只需添加此
即可function clearAll() {
document.getElementById('list').innerHTML='';
document.getElementById('files').value='';
}
答案 1 :(得分:0)
我认为这就是你想要的:http://jsfiddle.net/jogesh_pi/QC76K/2/
// Add Clear Button in HTML Section
<button id="clear">Clearall</button>
document.getElementById('clear').addEventListener('click', clearall, false);
function clearall(){
var list = document.getElementById('list');
var files = document.getElementById('files');
list.innerHTML = "";
files.value = "";
}