JS实现兼容IE6、IE7、IE8的图片上传前预览效果
2013-08-19 11:33
1031 查看
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>兼容IE6、IE7、IE8的图片上传前预览效果</title>
<meta http-equiv="content-type" content="text/html;charset=gb2312">
<!--把下面代码加到<head>与</head>之间-->
<script type="text/javascript" language="javascript">
function PreviewImg(imgFile){
var newPreview=document.getElementById("newPreview");
var imgDiv=document.createElement("div");
document.body.appendChild(imgDiv);
imgDiv.style.width="118px";imgDiv.style.height="127px";
imgDiv.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale)";
imgDiv.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src=imgFile.value;
newPreview.appendChild(imgDiv);
var showPicUrl=document.getElementById("showPicUrl");
showPicUrl.innerText=imgFile.value;
newPreview.style.width="80px";
newPreview.style.height="60px";
}
</script>
</head>
<body>
<!--把下面代码加到<body>与</body>之间-->
<div id="newPreview"></div>
<div id="showPicUrl"></div>
<hr><br>
请选择图片:<input type="file" name="file" onchange="javascript:PreviewImg(this);">
</body>
</html>
<html>
<head>
<title>兼容IE6、IE7、IE8的图片上传前预览效果</title>
<meta http-equiv="content-type" content="text/html;charset=gb2312">
<!--把下面代码加到<head>与</head>之间-->
<script type="text/javascript" language="javascript">
function PreviewImg(imgFile){
var newPreview=document.getElementById("newPreview");
var imgDiv=document.createElement("div");
document.body.appendChild(imgDiv);
imgDiv.style.width="118px";imgDiv.style.height="127px";
imgDiv.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale)";
imgDiv.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src=imgFile.value;
newPreview.appendChild(imgDiv);
var showPicUrl=document.getElementById("showPicUrl");
showPicUrl.innerText=imgFile.value;
newPreview.style.width="80px";
newPreview.style.height="60px";
}
</script>
</head>
<body>
<!--把下面代码加到<body>与</body>之间-->
<div id="newPreview"></div>
<div id="showPicUrl"></div>
<hr><br>
请选择图片:<input type="file" name="file" onchange="javascript:PreviewImg(this);">
</body>
</html>
相关文章推荐
- js实现图片上传前的预览,实现完美兼容Firefox3,IE6,IE7,IE8和IE9的显示问题
- js :实现图片上传前,预览客户端图片(兼容IE6和IE7)
- 兼容IE6,IE7,IE8和Firefox的图片上传预览效果
- 兼容ie6、ie7、ie8 和FF的本地上传图片预览,并客户端判断文件大小和文件格式
- js 上传图片预览 Firefox,IE6,IE7,IE8
- js实现图片上传及预览---------------------->>兼容ie6-8 火狐以及谷歌
- 上传图片前预览(兼容Firefox3,IE6,IE7,IE8)
- ie6,ie7,ie8和firefox下兼容的图片上传预览
- 兼容ie6、ie7、ie8 和FF的本地上传图片预览,并客户端判断文件大小和文件格式
- js实现图片上传及预览---------------------->>兼容ie6-8 火狐以及谷歌
- 上传图片前预览(兼容Firefox3,IE6,IE7,IE8)
- 多图片上传+图片预览,兼容所有浏览器 IE5/IE6/IE7/IE8/IE9/Chrome/Safari/Firefox/Opera/
- [转]很简单的JS实现上传前预览图片(兼容IE8)
- 兼容ie6、ie7、ie8 和FF的本地上传图片预览,并客户端判断文件大小和文件格式
- 图片上传预览,兼容IE6、IE7、IE8和firefox浏览器
- 多图片上传+图片预览,兼容所有浏览器 IE5/IE6/IE7/IE8/IE9/Chrome/Safari/Firefox/Opera/
- 原生js FileReader对象实现图片上传本地预览效果
- JS兼容各个浏览器的本地图片上传即时预览效果
- JS实现图片上传时的本地预览,兼容IE和firefox谷歌
- js实现图片sh上传预览效果