Only for IE:<input  type = file onfocusin="alert('请选择文件.');">

解决方案 »

  1.   

    sorry,这个事件不可靠,不要用。
    测了几次,效果不一样,有时竟然还有死循环
      

  2.   

    <input  type = file >
    <input  type = file id=aaa readonly onclick="this.readOnly=false;setTimeout('document.getElementById(\''+this.uniqueID+'\').readOnly=true;',1)">
      

  3.   

    让它不能获得焦点不就行了
    比如
    <form id="test" name="form" action="test.asp" method="post">
    <input type="text" name="test" onfocus="javascript:document.forms[0].test2.focus();" />
    <input type="text" name="test2" />
    </form>
    这样第一个就永远不会获得焦点了
      

  4.   

    <script>
    function doClick(obj){
    obj.readOnly=false;
    setTimeout('document.getElementById("aaa").readOnly = true',1);
    }
    </script>
    <input  type = file id=aaa readonly onclick="doClick(this)">
      

  5.   

    我觉得不让他获得焦点这个方法不错,呵呵
    一般<input type="file" /> 都是看本地的文件了,又不是看服务端的文件
      

  6.   

    <input type="text" id="filename" readonly /><input type="file" id="hiddenfile" style="width:0px;border:0px"  onchange="setvalue(this);"/>
    <script type="text/javascript">
    function setvalue(file)
    {
    var filename=document.getElementById("filename");

    filename.value=file.value;
    }
    </script>
      

  7.   

    pulongywk(天际翔龙)这个好,我喜欢
      

  8.   

    但是在Firefox下file还是会显示出现,而且也可以修改了