以下代码是html+JavaScript实现的带有图片预览功能的上传表单
1、
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>带有图片预览功能的上传表单</title>
<script>
function viewmypic(imgfile) {
if (imgfile.value){
document.getElementById("showimg").outerHTML='<img name="showimg" id="showimg" src="'+imgfile.value+ '" style="display:block;border:1;" alt="图片预览" /> '
}
}
</script>
</head>
<body>
<center>