因为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 />

相关文章: