下面是保存一个图片为示例,代码来源于网络,希望能够给大家带来一定的帮助,代码如下:

<script type="text/javascript"> 
function saveFile(imgUrl) 
{ 
 var oPop=window.open(imgUrl,"","width=1, height=1, top=5000, left=5000"); 
 for(;oPop.document.readyState != "complete"; ) 
 { 
  if(oPop.document.readyState=="complete")break; 
 } 
 oPop.document.execCommand("SaveAs"); 
 oPop.close(); 
} 
</script> 
</head>
<body>
<img src="/UploadFiles/2021-04-02/mytest.jpg">

方法二:

function SaveAs5(imgURL)
  {
  var Pop = window.open(imgURL,"","width=1, height=1, top=5000, left=5000");
  for(; oPop.document.readyState != "complete"; )
  {
  if (oPop.document.readyState == "complete")break;
  }
  oPop.document.execCommand("SaveAs");
  oPop.close();
  }

<img src="/UploadFiles/2021-04-02/t_screenshot_17616.jpg">

方法三:

function SaveAs5(imgURL)
  {
  var Pop = window.open(imgURL,"","width=1, height=1, top=5000, left=5000");
  for(; oPop.document.readyState != "complete"; )
  {
  if (oPop.document.readyState == "complete")break;
  }
  oPop.document.execCommand("SaveAs");
  oPop.close();
  }

<img src="/UploadFiles/2021-04-02/t_screenshot_17616.jpg">

以上所述就是本文的全部内容了,希望大家能够喜欢。

华山资源网 Design By www.eoogi.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
华山资源网 Design By www.eoogi.com