<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>带有图片预览功能的上传表单--cnwebshow.com</title>
<script>
function viewmypic(mypic,imgfile) {
if (imgfile.value){
mypic.src=imgfile.value;
mypic.style.display="";
mypic.border=1;
}
}
</script>
</head>
<body>
<center>
<form >
<input name="imgfile" type="file" id="imgfile" size="40" onChange="viewmypic(showimg,this.form.imgfile);" />
<br />
</form>
<img src="002.jpg" alt="图片浏览" name="showimg" id="showimg" />
<br />
</center>
</body>
</html>
?