IE兼容上传图片预览
2016-09-01 17:42
155 查看
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
<script>
function $(o) {
return document.getElementById(o);
}
function SeePic(img,f){
var i = $(img);
var f = $(f);
if (f.value != "") {
if (f.value.indexOf("http://") >= 0) {
i.src = f.value;
} else {
if (!window.event)
{
var data = f.files.item(0).getAsDataURL();
i.src = 'data:' + data;
}
else
i.src = 'file:///'+f.value;
}
i.style.display = "block";
return;
}
i.style.display = "none";
}
</script>
</head>
<form id='frm1' name='frm1'>
<div><input type='file' name='upfile' id='upfile' onChange="SeePic('img', 'upfile');"></div>
<div><image src='' id='img' name='img' style="display:none;"> </div>
</form>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
<script>
function $(o) {
return document.getElementById(o);
}
function SeePic(img,f){
var i = $(img);
var f = $(f);
if (f.value != "") {
if (f.value.indexOf("http://") >= 0) {
i.src = f.value;
} else {
if (!window.event)
{
var data = f.files.item(0).getAsDataURL();
i.src = 'data:' + data;
}
else
i.src = 'file:///'+f.value;
}
i.style.display = "block";
return;
}
i.style.display = "none";
}
</script>
</head>
<form id='frm1' name='frm1'>
<div><input type='file' name='upfile' id='upfile' onChange="SeePic('img', 'upfile');"></div>
<div><image src='' id='img' name='img' style="display:none;"> </div>
</form>
</body>
</html>
相关文章推荐
- 图片上传预览(兼容火狐和IE)
- 兼容IE和FF的图片上传前预览js代码
- javascript 上传 预览图片 兼容 谷歌 ie
- jQuery上传图片预览,简洁版,可兼容IE和FIREFOX
- 图片上传前预览(兼容FF和IE)
- 上传图片带预览功能兼容IE和火狐等主流浏览器
- JavaScript实现本地图片上传预览功能(兼容IE、chrome、FF)
- 上传时获取文件的完整路径图片预览的js代码(兼容Firfox和IE)
- JavaScript实现本地图片上传预览功能(兼容IE、chrome、FF)
- 图片上传并预览(IE,火狐浏览器兼容问题)
- 图片上传前预览(兼容FF和IE)
- 兼容IE,FF的上传图片预览
- 【转】图片上传简单JS预览,兼容IE火狐等主流浏览器
- 图片上传前的本地预览,兼容IE的方法
- 兼容所有主流浏览器的图片上传本地预览(IE\FIREFOX\CHROME)
- 兼容IE和FF的图片上传前预览js代码
- 图片上传预览 兼容ie67 8 9 及 FF
- JS实现图片上传时的本地预览,兼容IE和firefox谷歌
- 同时兼容IE和FF的图片上传判断及预览脚本
- 兼容IE、谷歌Chrome、火狐Firefox的图片上传预览功能