1. // 
  2.  
  3. <input type="file" id="x" /><button onclick="clearf();">clear</button> 
  4. //  
  5.  
  6. <script type="text/javascript"> 
  7.  var clearf = function(){  
  8.   var dx = document.getElementById('x');  
  9.   dx.value = ''; //火狐这样就可以了 
  10. //下面的if段用于IE   
  11.  
  12. if(document.selection){  
  13.   dx.select(); document.selection.clear();  
  14.   }  
  15.  }; </script>