通过点连接来保存图片

来源:互联网 发布:软件界面设计欣赏 编辑:程序博客网 时间:2024/05/16 18:48

<!
doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="content-language" content="zh-cn">
<meta name="author" content="forfor">
<title> Test Document </title>
<script type="text/javascript">
<!--
function runSave(){
if (saveImg.location != "about:blank")window.saveImg.document.execCommand("SaveAs");
}
function saveImgAs(url){
if(window.saveImg && url)window.saveImg.location=url;
}
//-->
</script>
</head>
<body>
<img src="http://www.52hai.com/2005/smile/07.gif">
<href="#" onclick="saveImgAs('http://www.52hai.com/2005/smile/07.gif')">1</a><br>
<img src="http://www.52hai.com/2005/smile/06.gif">
<href="#" onclick="saveImgAs('http://www.52hai.com/2005/smile/06.gif')">1</a>
<iframe src="about:blank" name="saveImg" onload="runSave()" style="display:none;"></iframe>
</body>
</html>
 or

<img   src="http://expert.csdn.net/images/jspd_wdzx_flgg.gif"   id=mxh>  
  
<input   type=button   onclick="a=window.open(document.all.mxh.src);a.document.execCommand('SaveAs');a.close()"   value="save">  
  要求在同一个domain(域)   


通过点连接来保存图片