zoukankan      html  css  js  c++  java
  • web页面自动保存本页面的内容到本地

    web页面自动保存本页面的内容到本地的实现代码:
     
    <script language="javascript" type="text/javascript">
             //保存聊天记录到本地 
             function save_record() {
                 //取得当前日期作为文件名 
                 var time = new Date();
                 var filename = time.toLocaleDateString();
     
                 //获取当前页面部分内容 -------此处可以加深理解DOM树的节点模型
                 var record = document.documentElement. innerHTML ;
     
                 //打开新窗口保存 
                 var winRecord = window.open('about:blank', '_blank', 'top=0');
                 winRecord.document.open("text/html", "utf-8");
                 winRecord.document.write(record);
                 winRecord.document.execCommand("SaveAs", true, filename + "试卷分析报告" + ".htm");
                 winRecord.close();
             } 
     
        </script>
     
     
    在要点击保存的地方应用save_record()函数即可
  • 相关阅读:
    Wiggle Sort II
    Coin Change
    MPLS LDP 知识要点
    MPLS Aggreate & Untag
    Lab MPLS隐藏标签显示
    Lab MPLS过滤标签转发
    MPLS MTU Aggregation
    研究MPLS MTU的问题
    Lab 利用MPLS解决BGP路由黑洞
    MPLS 标签保留
  • 原文地址:https://www.cnblogs.com/xiaopanlyu/p/2950840.html
Copyright © 2011-2022 走看看