使用javascript编译html并将其转储到文件中
compile html with javascript and dump it to file
我有一个带有javascript代码的html,它可以修改html并打印数据,我想把这个页面转储到一个文件中。
<html>
<head>
<script type="text/javascript">
document.write("<h1>This is a heading one </h1>");
document.write("<p>This is a paragraph.</p>");
document.write("<p>This is another paragraph.</p>");
</script>
</head>
<body>
<h1>This is a heading two </h1>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
</body>
</html>
output.html
<html>
<head>
<script type="text/javascript">
document.write("<h1>This is a heading one </h1>");
document.write("<p>This is a paragraph.</p>");
document.write("<p>This is another paragraph.</p>");
</script>
</head>
<body>
<h1>This is a heading one </h1>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
<h1>This is a heading two </h1>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
</body>
</html>
我想我需要一些类似html+java脚本引擎的东西。。带有命令行界面的浏览器,这样我就可以调用页面,然后将其输出转储到文件中。。有什么想法吗??。。。感谢
如果你只想手动做几次,你可以使用IE 9开发工具。在IE 9中,可以执行F12,然后按Ctrl+S将文件保存到所需位置。
相关文章:
- console.log级别很少=错误转储
- 将JSON漂亮地转储到文本
- JQuery 快速转储对象的成员
- 从粘贴的 JSON 转储动态自动完成表单
- 故障转储缺少 NodeWebKit
- 使用 JavaScript 将大数据转储到 csv 文件
- 当我按空格键时,它会转储整个数据库
- Meteor:从服务器调用相互依赖的外部 API 并将数据转储到 db
- 将 Chrome 开发控制台转储到文本文件
- React+Redux.执行容器和转储组件中定义的所有方法/操作
- 转储chartjs数据中缺少的日期
- 我可以将 HTML 文本转储到变量中吗?
- 如何“;转储”;使用LinkedBrush插件为mpld3选择的点
- 通量:顶层视图不应该是“;转储”;(不要从存储中获取数据)
- 使用javascript编译html并将其转储到文件中
- 是否可以使用JavaScript转储DOM并保留CSS效果和布局
- 如何将带有函数的javascript数据转储到eval-able字符串
- V8 Javascript堆转储模式
- PhantomJS页面转储脚本问题
- 如何使用Javascript将json数据转储到json文件中