<input type="file" name="xls_filename" onkeydown="return false;">

解决方案 »

  1.   

    onpaste ="return false;" 不准粘贴
      

  2.   

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

  3.   

    onpaste ="return false;" 不准粘贴
    onfocus ="this.blur()" 不能获得焦点
    这两个配合着用就行了
      

  4.   

    晕,不能获得焦点有问题,连点按钮都没反应了
    还是用
    onkeydown = "return false"
    或者
    onkeyup = "return false"
      

  5.   

    为什么我这样提交,提交不了
    <script>
    function doClick(obj){
    obj.readOnly=false;
    setTimeout('document.getElementById("aaa").readOnly = true',1);
    }function ButClick(){
       // if(document.form1.txtFakeText.value==""){ //if(document.getElementById("xls_filename").value==""){
    // alert("请选择excel文件!");
    //}else{
    document.form1.action = "dlfxb.jsp";
    document.form1.submit();
    //}
    }</script>
     <form name="form1" method="post" action="">
    <input  type = file id=aaa readonly onclick="doClick(this)">
    <input type="button" name="Mits" onclick="ButClick()" value="导入" class=go-wenbenkuang>
    </form>
    提交不了,总是空,js也报错,不知道为什么
      

  6.   

    这样做上传文件会有问题,inputFile控件对象消失了,有谁能解决 
    <html>
    <head>
        <title>File Upload Example</title>
     <script language="JavaScript" type="text/javascript">
       function ButClick(){
    //document.form1.action = "dlfxb.jsp";
    document.form1.submit();     }
        function HandleFileButtonClick()
        {
            document.frmUpload.myFile.click();
            document.frmUpload.txtFakeText.value = document.frmUpload.myFile.value;
        }
        </script>
    </head>
    <body>
      <form name="frmUpload">
               <input type="file" name="xls_filename" style="display: ">
                <input type="text" name="txtFakeText" readonly="true" class=go-wenbenkuang >
                <input type="button" onclick="HandleFileButtonClick();" value="浏览Excel文件" class=go-wenbenkuang>
    <input type="button" name="Mits" onclick="ButClick()" value="导入" class=go-wenbenkuang>  </form>
    </body>
    </html>
      

  7.   

    上面的form发错了, <form name="form1" method="post" action="">
      

  8.   

    TRY:
    <input type="text" name="fn" id="fn" style="position:absolute;top:0px;left:0px;z-index:2;" readonly>
    <input type="file" name="xls_filename" style="position:absolute;top:0px;left:0px;z-index:1;" onchange="document.getElementById('fn').value=this.value;">
      

  9.   

    请不要试图调用file控件的click,出于安全考虑,浏览器不允许这样选择的文件提交http://community.csdn.net/Expert/topic/5399/5399327.xml?temp=.4108698