惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google DeepMind News
Google DeepMind News
罗磊的独立博客
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Last Week in AI
Last Week in AI
云风的 BLOG
云风的 BLOG
T
The Blog of Author Tim Ferriss
Y
Y Combinator Blog
A
About on SuperTechFans
WordPress大学
WordPress大学
B
Blog
Martin Fowler
Martin Fowler
Jina AI
Jina AI
I
InfoQ
P
Proofpoint News Feed
小众软件
小众软件
S
SegmentFault 最新的问题
V
V2EX
B
Blog RSS Feed
量子位
大猫的无限游戏
大猫的无限游戏
aimingoo的专栏
aimingoo的专栏
博客园 - 三生石上(FineUI控件)
MongoDB | Blog
MongoDB | Blog
美团技术团队

博客园 - ifishing

VI操作 HTML中小meta的大作用【转】 10种AJAX/JavaScript特效实例让你的网站更吸引人 10 Smart Javascript Techniques to Improve Your UI [译] JavaScript核心指南(JavaScript Core) 【转】 IE7浏览器模式中表格tr/td渲染的一个bug 强制将IE8设置为IE7兼容模式来解析网页【转】 jquery 模块拖拽【转】 jquery的Theme和Theme Switcher使用【转】 打败 IE 的葵花宝典:CSS Bug Table【转】 三谈Iframe自适应高度【转】 ff3.5已不再支持 -moz-opacity[转] 玩转jquery插件之flexigrid 【转】 JS实例:网页上图片延迟加载的JS代码 图片预加载并且自动等比例缩放的JS插件[转] jQuery表格插件:帮助Web设计者驾御HTML表格【转】 IE9允许前端开发获取到页面性能数据 Web开发者必须收藏的十大网站【转】 【转】打开,另存为,属性等14个javascript代码
【转】js实现另存为的方法 - ifishing - 博客园
ifishing · 2010-05-31 · via 博客园 - ifishing

示例代码:

<input   type=button   value=另存为   onclick="mm1()">  

<iframe   width=0   height=0   frameborder=0   name=hrong   style="display:   none"></iframe>
      <script language="JavaScript">
      //有窗口弹出的下载
     /* function openfile()
       {    
           var a;
           a =window.open("下载文件的URL","_blank", "width=0, height=0");
           a.document.execCommand("SaveAs");    
           a.close();  
      } */
      //无窗口弹出

      function   mm1()  
    {  
          var str="下载文件的URL";    
          window.frames["hrong"].location.href   =   str;  
          sa();  
}  
function   sa()  
{  
        if(window.frames["hrong"].document.readyState!="complete")  
            setTimeout("sa()",   100);  
      else  
          window.frames["hrong"].document.execCommand('SaveAs');  
}  
      </script>