相同的.html 文件,用JS实现图片预览,直接打开时能实现预览,可在tomcat下运行就不行了.太奇怪了!!!!!!!
这是怎么回事啊?????????????????????代码如下:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>图片上传</title>
<script>
function yulan()
{
if(document.all.form1.user_photo.value)
{
document.all.form1.viewpic.src=document.all.form1.user_photo.value;
document.all.form1.viewpic.style.display="";
document.all.form1.viewpic.border=1;
}
}
</script>
</head>
<body>
<center>
<form name="form1" id="form1">
<img name="viewpic" id="viewpic"  width="359" height="286"><input type="file" name="user_photo" id="user_photo" onChange="yulan();"></form></center>
</body>
</html>