新手求教:js文件在ie里正常,在ff和chrome里无法运行
<html><body><formmethod=postaction=""><inputtype="file"name="file"id="file1"onchange=...
<html>
<body>
<form method=post action="">
<input type="file" name="file" id="file1" onchange="getit();" />
</form>
<script>
function getit()
{
var a=document.getElementById("file1");
var img=document.createElement("img");
img.setAttribute("src","file://localhost/"+a.value);
document.body.appendChild(img);
}
</script>
</body>
</html> 展开
<body>
<form method=post action="">
<input type="file" name="file" id="file1" onchange="getit();" />
</form>
<script>
function getit()
{
var a=document.getElementById("file1");
var img=document.createElement("img");
img.setAttribute("src","file://localhost/"+a.value);
document.body.appendChild(img);
}
</script>
</body>
</html> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询