首頁  >  文章  >  web前端  >  javascript 儲存檔案到本機實作方法_javascript技巧

javascript 儲存檔案到本機實作方法_javascript技巧

WBOY
WBOY原創
2016-05-16 17:47:391455瀏覽

2種形式都可以
第一種:

複製代碼 代碼如下:

<script> <BR>function SaveAs5(imgURL) <BR>{ <BR>var oPop = window.open(imgURL,"","width=1, height=1, top=5000, left=5000" ); <BR>for(; oPop.document.readyState != "complete"; ) <BR>{ <BR>if (oPop.document.readyState == "complete")break; <BR>} <BR>oPopyState == "complete")break; <BR>} <BR>oPopyState .document.execCommand("SaveAs"); <BR>oPop.close(); <BR>} <BR></script>
javascript 儲存檔案到本機實作方法_javascript技巧

第二種: 複製代碼
程式碼如下:


<script> <BR>function SaveAs5(imgURL) <BR>{ <BR>var oPop = window.open(imgURL,"","width=1, var oPop = window.open(imgURL,"","width=1, cight =1, top=5000, left=5000"); <BR>for(; oPop.document.readyState != "complete"; ) <BR>{ <BR>if (oPop.document.readyState == "complete" )break; <BR>} <BR>oPop.document.execCommand("SaveAs"); <BR>oPop.close(); <BR>} <BR></script>
javascript 儲存檔案到本機實作方法_javascript技巧
點擊這裡下載圖片
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn