上传图片之前预览 fileupload
<%@ page language="c#" codefile="default7.asp教程x.cs" inherits="default7" %>
<!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 type="text/网页特效">
function showpreview() {
var filename = document.getelementbyidx('<%=fupimg.clientid%>').value;
if (filename != "") {
document.getelementbyidx('<%=imgpreview.clientid%>').src = filename;
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<img id="imgpreview" runat="server" width="230" height="80" src="7.gif" alt="" style="width: 70px; border:1px solid red" />
<asp:fileupload id="fupimg" runat="server" width="300" onchange="showpreview()" />
</div>
</form>
</body>
</html>
<head runat="server">
</head>
<body>
</body>
</html>
但是只能在ie6上使用,其他的需要设置一下才可以
补充:asp.net教程,基础入门