页面导航: 首页网络编程JavaScript → 正文内容 html下载本地

html下载本地

发布:dxy 字体:[增加 减小] 类型:转载

通过javascript 实现

index.html

<a href=# onclick="window.open('temp.html');return(false);">下载文件</a>

#######

temp.html  //被下载文件

  <Script language="javascript">
  if (typeof(window.opener) != 'undefined')   //判断 打开方式的下载。 去掉会一打开文件就弹出下载框
  {
   document.execCommand('SaveAs');
   window.close();
  }
  </Script> 

################

<button onclick="javascript:document.execCommand('SaveAs');">保存本页面</button>

浏览次数:载入中... 打印本文关闭本文返回首页
·在百度中搜索关于“html下载本地”相关内容
·在谷歌中搜索关于“html下载本地”相关内容

文章评论

共有 位脚本之家网友发表了评论我来说两句

同 类 文 章
最 近 更 新
热 点 排 行