81,091
社区成员
发帖
与我相关
我的任务
分享
<html>
<head>
<title>文件上传</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<script type="text/javascript">
function haha(){
document.getElementById("image1").src=document.getElementById("FILE1").value;
document.getElementById("image1").style.display ="";
//var a=document.getElementsByTagName("img");
/*for(var i=0;i<a.length;i++)
alert(a[i].alt);*/
}
</script>
<body>
<p> </p>
<p align="center">上传文件选择</p>
<FORM METHOD="POST" ACTION="do_upload.jsp"
ENCTYPE="multipart/form-data">
<input type="hidden" name="TEST" value="good">
<table width="75%" border="0" align="center">
<tr>
<td><div align="center">
<input type="FILE" onchange="haha()" id="FILE1" size="30">
<img src="" style="display:none" id="image1" alt="haha">
</div></td>
</tr>
<tr>
<td><div align="center">
<input type="submit" name="Submit" value="上传!">
</div></td>
</tr>
</table>
</FORM>
</body>
</html>
<html>
<head>
</head>
<script type="text/javascript">
function haha(){
document.getElementById("image1").src=document.getElementById("image").value;
document.getElementById("image1").style.display ="";
var a=document.getElementsByTagName("img");
for(var i=0;i<a.length;i++)
alert(a[i].alt);
}
</script>
<body>
<input type="file" onchange="haha()" id="image"></imput><br/>
<img src="" style="display:none" id="image1" alt="haha">
</body>
</html>