关于ASP.NET浏览显示图片问题
我想做1个点击FileUpload浏览.选定图片后在img里立即显示图片!!最好能有代码描述的..谢谢!!...
我想做1个点击FileUpload浏览.选定图片后在img里立即显示图片!!
最好能有代码描述的..谢谢!! 展开
最好能有代码描述的..谢谢!! 展开
1个回答
展开全部
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
<script language="javascript" type="text/javascript">
function Preview(imgSrc)
{
document.getElementById("Image1").src = imgSrc;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Image ID="Image1" Width="100px" runat="server" />
<asp:FileUpload ID="FileUpload1" runat="server" onchange="Preview(this.value);" />
</div>
</form>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
<script language="javascript" type="text/javascript">
function Preview(imgSrc)
{
document.getElementById("Image1").src = imgSrc;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Image ID="Image1" Width="100px" runat="server" />
<asp:FileUpload ID="FileUpload1" runat="server" onchange="Preview(this.value);" />
</div>
</form>
</body>
</html>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询