[javascript] view plaincopyprint?
- <script language="JavaScript">
- function savepic(){
- if(document.all.a1==null){
- objIframe=document.createElement("IFRAME");
- document.body.insertBefore(objIframe);
- objIframe.outerHTML= "<iframe name=a1 style=‘width:0;hieght:0‘ src="+pic1.href+"></iframe>";
- re=setTimeout("savepic()",1)
- }
- else{
- clearTimeout(re)
- pic = window.open(pic1.href,"a1")
- pic.document.execCommand("SaveAs")
- document.all.a1.removeNode(true)
- }}
- </script>
[html] view plaincopyprint?
- <a href="b.txt" id="pic1" onclick="savepic();return false;" style="cursor:hand">
- 单击下载
- </a>
时间: 2024-10-16 06:02:30