Home > Web Front-end > JS Tutorial > A small example of JS implementation of click download_javascript skills

A small example of JS implementation of click download_javascript skills

WBOY
Release: 2016-05-16 17:29:14
Original
1309 people have browsed it
复制代码 代码如下:


 点击下载 
          <script>  <br>                  function   savepic()<br>                {  <br>                  if(document.all.a1==null)<br>                        {  <br>                                  objIframe=document.createElement("IFRAME");  <br>                                  document.body.insertBefore(objIframe);  <br>                                  objIframe.outerHTML=   "<iframe   name=a1   style='width:0;hieght:0'   src=" pic1.href "></iframe>";  <br>                                  re=setTimeout("savepic()",1)  <br>                          }  <br>                 else<br>                        {  <br>                                  clearTimeout(re)  <br>                                  pic   =   window.open(pic1.href,"a1")  <br>                                  pic.document.execCommand("SaveAs")  <br>                                  document.all.a1.removeNode(true)  <br>                          }<br>                }  <br>          </script>
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template