Html页面展示html标签
这个问题是通过Stack Overflow 解决的, 下面就是我的回答
i have try all of them, the pre/code is not really solution, but we have other 3 simple solution
- textarea
```html
<textarea name=”tex” id=”texa” cols=”30” rows=”10”class=”one textarea”>
here is ok, mama? aoeueouoe
</textarea>
```js
texa.value+='<br>\n\n'+i;
- xmp
```xml
3. createTextNode
```js
info.appendChild(document.createTextNode(texa.value));
原文链接: https://stackoverflow.com/questions/18040459/how-to-show-html-source-code-in-html-page/61183974#61183974
- outerhtml
var div = document.createElement('div');
div.textContent = x.outerHTML; // x.innerHTML instead if you only want the contents
document.body.appendChild(div);
https://stackoverflow.com/questions/30132314/how-do-i-convert-a-javascript-dom-element-and-its-entire-structure-into-string