因为File控件的value值是只读的,所以用document.getElementById(“File1″).value=”" 并不能清楚file控件的值。

可以用一下方法实现

    <script type="text/javascript">
        function clear() {

            var file1 = document.getElementById("File1");

            file1.select();

            document.execCommand('Delete')

        }
    </script>
    <input />

相关文章:

  • 2021-09-20
  • 2022-12-23
  • 2021-11-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-03
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-25
  • 2022-02-09
  • 2021-12-19
  • 2022-12-23
相关资源
相似解决方案