在.HTA中获取带有大写标签的页面html和没有引号的属性

时间:2018-05-08 09:41:40

标签: javascript activex hta

我正在使用JavaScript处理.HTA文件中的小应用程序。当我尝试获取当前页面的所有html时,我得到大写的所有标签,属性没有双引号。

简单示例:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="x-ua-compatible" content="ie=9.0" />
<meta charset="utf-8">
<title>Test</title>
</head>
<body>
<div class="content">Some text</div>
<script>
var html = document.querySelector('html').innerHTML;
alert(html);

var writeStream = new ActiveXObject('ADODB.Stream');
writeStream.Type = 2;
writeStream.Open();
writeStream.Charset = 'utf-8';
writeStream.WriteText(html);
writeStream.SaveToFile('index.html', 2);
writeStream.Close();
</script>
</body>
</html>

所以index.html的源代码是:

<HEAD><TITLE>Test</TITLE>
<META content=ie=9.0 http-equiv=x-ua-compatible>
<META charset=utf-8></HEAD>
<BODY>
<DIV class=content>Some text</DIV>
<SCRIPT>
var html = document.querySelector('html').innerHTML;
alert(html);

var writeStream = new ActiveXObject('ADODB.Stream');
writeStream.Type = 2;
writeStream.Open();
writeStream.Charset = 'utf-8';
writeStream.WriteText(html);
writeStream.SaveToFile('index.html', 2);
writeStream.Close();
</SCRIPT>
</BODY>

但是我需要小写的所有标签和双引号的属性,因为它通常是HTML。

0 个答案:

没有答案