转载地址:http://blog.csdn.net/awinliu/article/details/9401083
<a href="picName.jpg" id=pic1 οnclick="savepic();return false;"style="cursor:hand">点击下载</a>
<span style="white-space:pre"> </span>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);
}
}