【发布时间】:2015-06-24 12:21:14
【问题描述】:
我需要使用纯 javascript 保存 div 的内容。 我刚刚编辑了一个小提琴,但我无法使它工作:(
<div id="content">
<h1>Hello world</h1>
<i>Hi everybody</i>
下载
function download(){
var a = document.body.appendChild(
document.createElement("a")
);
a.download = "export.html";
a.href = "data:text/html," + document.getElementById("content");
}
【问题讨论】:
标签: javascript html file button save