我有这个 HTML:
<script type="text/javascript">
function uploadDone(response) {
alert(response);
}
function init() {
document.getElementById('file_upload_form').onsubmit=function() {
document.getElementById('file_upload_form').target = 'upload_target'; //'upload_target' is the name of the iframe
document.getElementById("upload_target").onload = uploadDone(response);
}
}
</script>
<form method="get" id="file_upload_form" enctype="multipart/form-data" action="../includes/parsecsv.ajax.php" target="upload_target">
<label class="uploadClick">
<button class="normal">Click to Upload Sign Ups CSV</button>
<input type="file" id="uploadSignups file" name="file">
</label>
<span class="uploadDrag"><span>or</span>Drag Your Sign Ups CSV Here</span>
<button type="submit" name="action">hello</button>
<iframe id="upload_target" name="upload_target" src="" style="width:0px; height:0px; border:none;"></iframe>
</form>
应该是,当您单击提交按钮时,通过<iframe>
. 我似乎已经能够让它进行上传,但是上传完成后它似乎没有运行uploadDone()
?有什么想法有什么问题吗?