html元素中,我们在textarea元素中输入的内容,是没有样式的,如果想要输入的字体有颜色或者加粗,等等样式,如何实现呢?可以用div来实现,示例如下:
<textarea id="test"></textarea>
<script language="javascript">
var str="<font><b>abcde</b></font>";
txt=document.createElement('DIV');
txt.innerHTML=str;
test.appendChild(txt);
window.οnbefοreunlοad=function oLoad(){document.location.reload()}
</script>