zoukankan      html  css  js  c++  java
  • JS 实现图片直接下载

    < 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='400px;hieght:300px' src=" + imageName.href + "></iframe>";
                    re = setTimeout("savepic()", 1)
                }
                else {
                    clearTimeout(re)
                    pic = window.open(imageName.href, "a1")
                    pic.document.execCommand("SaveAs")
                    document.all.a1.removeNode(true)
                }
            } 
    </script>
  • 相关阅读:
    软件测试
    软件测试
    软件测试
    软件测试
    软件测试
    软件测试
    软件测试
    软件测试
    软件测试
    When:什么时候做集成测试
  • 原文地址:https://www.cnblogs.com/jiangu66/p/3206690.html
Copyright © 2011-2022 走看看