我有 html 和 javascript 代码,可以修改 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>
输出.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 Dev 工具。在 IE 9 中,您可以按 F12,然后按 Ctrl+S 将文件保存到所需位置。
关于javascript - 使用 javascript 编译 html 并将其转储到文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9646337/