使用javascript

时间:2016-07-26 12:26:31

标签: javascript html dom escaping special-characters

作为基础,我们有以下HTML页面:

<html><body>
    <div>Unescaped characters: < > </div>
    <div>Escaped characters: &lt; &gt; </div>
</body></html>

Testcase 1:innerHTML和outerHTML(result =都被转义)

<div>Unescaped characters: &lt; &gt; </div>
<div>Escaped characters: &lt; &gt; </div>

测试用例2:innerText(结果=未转义)

<div>Unescaped characters: < > </div>
<div>Escaped characters: < > </div>

哪个javascript函数会给我一些开头显示的确切HTML源代码(一个转义,另一个未转义)?

0 个答案:

没有答案