我在我的网页中添加了一个表单,允许上传多个文件。我添加了输入<input type="file" name="photo_upload[]" id="photo_upload" multiple="multiple" />
。
我尝试添加一个警告,该警告仅在浏览器不支持多文件功能时才可见。我试过这段代码:
<script type="text/javascript">
var testrange=document.createElement("input")
testrange.setAttribute("multiple", "multiple")
if (testrange.multiple=="multiple"){
document.getElementById('multiple_warning').style.display = 'none';
}
</script>
<div id="multiple_warning" style="background:#FFFF99; border:dashed; border-width:thin;">Sorry, but your browser does not support the multiple file upload feature.<br />
If you have more than one photo to send us, please send it after you recieved your comformation email.</div>
但无论如何它总是显示“multiple_warning”。我怎样才能让它正常运行?