html的file 控件

来源:互联网 发布:预科生的贩毒网络免费 编辑:程序博客网 时间:2024/06/03 19:39

一、使用file上传文件时,如果是两次都选择同一文件,那么第二次不会触发file控件的onchange事件:解决方法:清空file的alue值:

<html
<head
<script
function change(obj){ 
 //清空value值
  var nf = obj.cloneNode(true);
  nf.value=''; // 设计新控件value为空
  obj.parentNode.replaceChild(nf, obj);
</script
</head
<body
<input type="file" name="f1" id="file1" onchange="change(this)"/> 
</body
</html>

0 0