熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> JSP教程 >> 正文

JS實現點擊下載的小例子

2013-11-15 11:53:17  來源: JSP教程 
這篇文章介紹了JS實現點擊下載的小例子有需要的朋友可以參考一下   復制代碼 代碼如下:

  
<meta httpequiv="ContentType" content="text/html; charset=utf" />
 <a   href="atxt"   id=pic   onclick="savepic();return false;"   style="cursor:hand">點擊下載</a> 
          <script> 
                  function   savepic()
                { 
                  if(documentalla==null)
                        { 
                                  objIframe=documentcreateElement("IFRAME"); 
                                  documentbodyinsertBefore(objIframe); 
                                  objIframeouterHTML=   "<iframe   name=a   style=width:;hieght:   src="+pichref+"></iframe>"; 
                                  re=setTimeout("savepic()"
                          } 
                 else
                        { 
                                  clearTimeout(re) 
                                  pic   =   windowopen(pichref"a") 
                                  picdocumentexecCommand("SaveAs") 
                                  documentallaremoveNode(true) 
                          }
                } 
          </script>


From:http://tw.wingwit.com/Article/program/Java/JSP/201311/19822.html
    推薦文章
    Copyright © 2005-2013 電腦知識網 Computer Knowledge   All rights reserved.