<input accept="" accessKey="" alt="" class="fileInput" dir="" lang="" name="j_id0:j_id10:fileName:inputFile:file" onblur="" onchange="" onclick="" ondblclick="" onfocus="" onkeydown="" onkeypress="" onkeyup="" onmousedown="" onmousemove="" onmouseout="" onmouseover="" size="" style="" tabindex="" title="" type="file" />
setInterval('ShowClearBtn()', 300);
            
            });
            function ShowClearBtn () {
                if (jQuery('.fileInput').val() != ''){
                    jQuery('.clearBtn').css('visibility', 'visible');
                }
            }在firefox and safari and 谷歌都没有问题。可以IE 就不行。我用的是IE 7.请大家帮帮忙。在此谢过。

解决方案 »

  1.   

    I think so。不过由于生成的file 在服务器端。所以再添加会很麻烦。
     
    thanks.
      

  2.   


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    </head>
    <body>
    <input type="file" id="files" />
    <input type="button" id="btn" value="clear" />
    <script type="text/javascript">
    document.getElementById('btn').onclick = function() {
    var o = document.getElementById('files')
    if(!!document.all) {
    o.select();
    document.execCommand("delete");
    } else {
    o.value = '';
    }
    }
    </script>
    </body>
    </html>
      

  3.   

    移除掉,再用jquery创建一个这样的标签
      

  4.   

    var file = jQuery('.fileInput');
           file.after(file.clone().val(''));
            file.remove();I have been solved.thanks.buddy.