我的HTML带有修改html并打印数据的javascript代码,
我想将此页面转储到文件中。

<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 Dev工具。在IE 9中,可以执行F12,然后按Ctrl + S将文件保存到所需位置。

关于javascript - 用javascript编译html并将其转储到文件,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/9646337/

10-17 00:02
查看更多