Home  >  Article  >  Web Front-end  >  jquery code to save part of the content of the html page into a new html file_jquery

jquery code to save part of the content of the html page into a new html file_jquery

WBOY
WBOYOriginal
2016-05-16 18:41:551468browse
Copy code The code is as follows:

//Save the chat record to local
function save_record()
{
//Get the current date as the file name
var time=new Date();
var filename=time.toLocaleDateString();
//Get part of the current page content
var record=$("#contentList").html();
//Open a new window to save
var winRecord=window.open('about:blank','_blank','top=500') ;
winRecord.document.open("text/html","utf-8");
winRecord.document.write("" record "");
winRecord.document. execCommand("SaveAs", true, filename ".html");
winRecord.close();
}
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn