FileUpload 上传图片前实现预览

it2022-05-16  65

前台代码:

    <form id="form1" runat="server">        <div>            <asp:FileUpload ID="file" runat="server" />

            <img id="img" style="display:none; width:120px; height:100px;" />

        </div>    </form>

 

后台:

        protected void Page_Load(object sender, EventArgs e)        {            file.Attributes.Add("onchange", "document.getElementById('img').src=this.value;");        }

转载于:https://www.cnblogs.com/lichaoasd/archive/2011/11/16/2251023.html

相关资源:数据结构—成绩单生成器

最新回复(0)