代码如下:
//保存聊天记录到本地
function save_record()
{
//取得当前日期作为文件名
var time=new Date();
var filename=time.toLocaleDateString();
//获取当前页面部分内容
var record=$("#contentList").html();
//打开新窗口保存
var winRecord=window.open('about:blank','_blank','top=500');
winRecord.document.open("text/html","utf-8");
winRecord.document.write("htmlstylebody,ul,li{margin:0px; padding:0px;list-style:none; font-size:12px;}/stylebody"+record+"/body/html");
winRecord.document.execCommand("SaveAs", true, filename+".html");