The following code prints
This should print(b)This should print(/b)This should print
<script>
function produceMessage(){
var msg= '<b>This should print</b>';
return msg;
}
</script>
<span id="mySpan"></span>
<script>
document.body.appendChild(document.createTextNode(produceMessage()));
document.write(produceMessage());
document.getElementById('mySpan').innerHTML=produceMessage();
</script>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…