你说的什么意思
“就调用onclick()来打开文件浏览器;”
是不是说如果是空的话就让它能onclick就能打开浏览器

解决方案 »

  1.   

    <?xml version="1.0" encoding="UTF-8"?><html xmlns="http://www.w3.org/TR/xhtml1">
    <head>
    <script language="JavaScript">
    function fillnext(){
        var aa=new Array();
    var cc=new Array();
    var textArray=document.getElementsByTagName("input");
    for(var i=0;i<textArray.length;i++){
        if(textArray[i].type=="text"){
    aa.push(textArray[i].id);
    }
    else{
    cc.push(textArray[i].id);
    }
    }

    for(var j=0;j<aa.length;j++){
    if(document.getElementById(aa[j]).value==""){
    document.getElementById(cc[j]).click()
    break;
           }
      }
     }
    </script>

    </head>

    <body>

    <a href="#" onclick="fillnext();">browser</a>
    <br>
    <input type="text" id="filetext1" readonly style="border-top-width: 0px;border-right-width: 0px;border-bottom-width: 0px; border-left-width: 0px;">
    <input type="file" name="filetext1" id="file1" style="display:none" onchange='document.getElementById("filetext1").value=this.value'>
    <br><input type="text" id="filetext2" readonly style="border-top-width: 0px;border-right-width: 0px;border-bottom-width: 0px; border-left-width: 0px;">
    <input type="file" name="filetext2" id="file2" style="display:none" onchange='document.getElementById("filetext2").value=this.value'>
    <br><input type="text" id="filetext3" readonly style="border-top-width: 0px;border-right-width: 0px;border-bottom-width: 0px; border-left-width: 0px;">
    <input type="file" name="filetext3"  id="file3" style="display:none" onchange='document.getElementById("filetext3").value=this.value'>
    <br></body>
    </html>