Posted in Javascript onJuly 22, 2013
<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=" + 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>
JS 实现图片直接下载示例代码
声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@