html里怎么弹出另存为对话框
展开全部
<!--图片另存为--->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title$amp;>amp;$nbsp;通过js保存图片到本地 </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<script src="" type="text/javascript"$amp;>amp;$lt;/script>
<script>
function DownLoadReportIMG(imgPathURL) {
//如果隐藏IFRAME不存在,则添加
if (!document.getElementById("IframeReportImg"))
$('<iframe id="IframeReportImg" name="IframeReportImg" onload="DoSaveAsIMG();" width="0" height="0" src="about:blank"$amp;>amp;$lt;/iframe$amp;>apos;$).appendTo("body");
if (document.all.IframeReportImg.src != imgPathURL) {
//加载图片
document.all.IframeReportImg.src = imgPathURL;
}
else {
//图片直接另存为
DoSaveAsIMG();
}
}
function DoSaveAsIMG() {
if (document.all.IframeReportImg.src != "about:blank")
document.frames("IframeReportImg").document.execCommand("SaveAs");
}
</script>
</head>
<body>
<input type="button" value="download image" onclick="DownLoadReportIMG('');"$amp;>amp;$nbsp;
</body>
</html>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询