Home > Web Front-end > JS Tutorial > body text

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

WBOY
Release: 2016-05-16 18:41:55
Original
1463 people have browsed it
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();
}
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!