<span id=span1>
<input name=ab type=file>
</span>
<input name=button1 type=button value="按" onclick=show()>
<script language=javascript>
function show()
{
document.getElementById("span1").innerHTML="<input name=ab type=file>";
}
</script>

解决方案 »

  1.   

    file控件好像是不能用脚本赋值的吧,要不然你不是可以取走客户端的任何文件了?
      

  2.   

    只能重新构造一下,file不许用脚本写值,为只读关于日期的常见操作
    http://community.csdn.net//Expert/TopicView2.asp?id=4360247&datebasetype=now
    js FAQ贴
    http://community.csdn.net//Expert/TopicView2.asp?id=4356360&datebasetype=now
    DHTML手册,js手册,dom手册下载
    http://community.csdn.net//Expert/TopicView2.asp?id=4356325&datebasetype=now
      

  3.   

    如果觉得我上面的代码需要一个<span>不好,可以用下面的<input name=ab type=file>
    <input name=button1 type=button value="按" onclick=show()>
    <script language=javascript>
    function show()
    {
    document.getElementById("ab").outerHTML="<input name=ab type=file>";
    }
    </script>
      

  4.   

    谢谢 hbhbhbhbhb1021(天外水火(我是SB,我要多努力)) 及各位,采用 hbhbhbhbhb1021(天外水火(我是SB,我要多努力)) 的方法了,可以了。