<input id="t1" type="file">在点击浏览赋值后,怎么样把该值去掉,使输入框置空?
用document.getElementById('t1').values='';不行。
希望高手指点?

解决方案 »

  1.   

    代码如下:
    function aa(){
       document.fileForm.t1.click();
    var val=document.fileForm.t1.value; 
    if(val==""){
    return;
    }else{
    var tt=document.fileForm.sele;
    var tiem=document.createElement("OPTION");
    tt.options.add(tiem);
    tiem.value=val;
    tiem.innerText=val;
    document.fileForm.t1.value=""
    var v=document.fileForm.t1.value;
    }
    } <input id="t1" type="file" style="display:none"><p> 
    <select style="FONT-SIZE: 12px; WIDTH: 90%; COLOR: #006cad; BACKGROUND-COLOR: #ffffff" multiple="multiple" size="12" name="sele" id="sele">
    </select> 
    <input type=button value="上传文件" style="font-size:12px;height:19"onclick="blur();aa()"/>
      

  2.   

    "document.getElementById('t1').values = '';"楼主写错了,所以文本框清空不了.红色部分改为: value
      

  3.   

    var tt=document.fileForm.sele; 
    var tiem=document.createElement("OPTION"); tiem.value=val; //先给option赋值
    tiem.innerText=val;
     tt.options.add(tiem);   //再添加
    document.fileForm.t1.value="" 
    var v=document.fileForm.t1.value;