上传图片前的本地预览解决办法
代码<!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 content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>IE7关闭窗口时总是提示和上传图片前的本地预览解决办法</title>
</head>
<body>
<!--以下均支持IE6和IE7,不支持Firefox2.0,其他浏览器未经测试-->
<script type="text/javascript">
function CloseWin()
{
window.opener=null;
window.open("","_self");
window.open("","_self");window.open("","_self");window.close();
}
function Preview(imgFile)
{
document.getElementById("pic").filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = imgFile.value;
}
</script>
<a href="javascript:CloseWin();">点击这里无提示关闭当前窗口</a><br>请选择要预览的图片:<input onchange="javascript:Preview(this);" type="file"><br>
<div id="pic" style="filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale); width: 400px; height: 200px;">
</div>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>IE7关闭窗口时总是提示和上传图片前的本地预览解决办法</title>
</head>
<body>
<!--以下均支持IE6和IE7,不支持Firefox2.0,其他浏览器未经测试-->
<script type="text/javascript">
function CloseWin()
{
window.opener=null;
window.open("","_self");
window.open("","_self");window.open("","_self");window.close();
}
function Preview(imgFile)
{
document.getElementById("pic").filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = imgFile.value;
}
</script>
<a href="javascript:CloseWin();">点击这里无提示关闭当前窗口</a><br>请选择要预览的图片:<input onchange="javascript:Preview(this);" type="file"><br>
<div id="pic" style="filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale); width: 400px; height: 200px;">
</div>
</body>
</html>
posted on 2010-09-18 15:29 skind@126.com 阅读(110) 评论(0) 收藏 举报

浙公网安备 33010602011771号