复制代码 代码如下:
<a href="picName.jpg" id=pic1 onclick="savepic();return false;" style="cursor:hand">点击下载</a>
复制代码 代码如下:
<script type="text/javascript">
function savepic() {
if (document.all.a1 == null) {
objIframe = document.createElement("IFRAME");
document.body.insertBefore(objIframe);
objIframe.outerHTML = "<iframe name=a1 style='width:400px;hieght:300px' src="/UploadFiles/2021-04-02/ + imageName.href + ">re = setTimeout("savepic()", 1)
}
else {
clearTimeout(re)
pic = window.open(imageName.href, "a1")
pic.document.execCommand("SaveAs")
document.all.a1.removeNode(true)
}
}
</script>
<a href="picName.jpg" id=pic1 onclick="savepic();return false;" style="cursor:hand">点击下载</a>
复制代码 代码如下:
<script type="text/javascript">
function savepic() {
if (document.all.a1 == null) {
objIframe = document.createElement("IFRAME");
document.body.insertBefore(objIframe);
objIframe.outerHTML = "<iframe name=a1 style='width:400px;hieght:300px' src="/UploadFiles/2021-04-02/ + imageName.href + ">re = setTimeout("savepic()", 1)
}
else {
clearTimeout(re)
pic = window.open(imageName.href, "a1")
pic.document.execCommand("SaveAs")
document.all.a1.removeNode(true)
}
}
</script>
标签:
JS,图片下载
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
桃源资源网 Design By www.nqtax.com
暂无“JS 实现图片直接下载示例代码”评论...