如何解决IHTMLDocument2 write无法正确处理IHTMLStyleSheet中的样式名称有解决方案吗?
请在下面查看此html。将其输入IHTMLDocument2.write。现在,通过get_styleSheets提取标题样式。令人惊讶的是,IHTMLStyleSheet.get_cssText返回2个TR.green条目,即
TR.hometown {BACKGROUND: yellow}
TR.green {BACKGROUND: green}
TR.green {BACKGROUND: #ff0000}
与输入的html不同。 除了自己解析html之外,还有其他解决方法吗:-(?
<html><head><style>
tr.hometown { background: yellow; }
tr.hometown.green { background: green;}
tr.green{background: #ff0000;}
</style></head><body><table>
<tr class="green"><td><p>Red background.</p></td></tr>
<tr class="hometown green"><td><p>green background.</p></td></tr>
<tr><td><p>normal text.</p></td></tr>
<tr class="hometown"><td><p>yellow background.</p></td></tr>
<tr><td><h1 class="hometown">header 1 text</h1></td></tr>
</table></body></html>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。