如何使用js创建一个上传控件,效果和如下代码一样?
<asp:FileUpload ID="FileUpload1" runat="server" Width="338px" Visible =true />
为什么document.createElement("<asp:FileUpload ID="FileUpload1" runat="server" Width="338px" Visible =true />"); 报错呢?那该怎么写呢?
<asp:FileUpload ID="FileUpload1" runat="server" Width="338px" Visible =true />
为什么document.createElement("<asp:FileUpload ID="FileUpload1" runat="server" Width="338px" Visible =true />"); 报错呢?那该怎么写呢?
你只能创建<input type="file"....
你可以创建等效的HTML控件
{
var str = '<INPUT type="file" size="50" NAME="File"><br/>';
document.getElementById('MyFile').insertAdjacentHTML("beforeEnd",str);
}
<INPUT class="bluebutton" id="FindFile" style="Z-INDEX: 101; LEFT: 36px;
WIDTH: 274px; POSITION: absolute; TOP: 123px; HEIGHT: 22px ;display:none"
type="file" size="26" runat="server" NAME="FindFile" onserverclick="Button1_Click" >