日期:2014-05-16  浏览次数:20443 次

js中怎么控制添加到<textarea>中文字的颜色呢?
像这样,我为了突出人名,求教一下
------解决方案--------------------
使用div!!
------解决方案--------------------
对,使用div去模似。


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <title> New Document </title>
  <meta name="Generator" content="EditPlus">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
 </head>

 <body>
  <div id="tt" contenteditable="true"></div>
  <script>
document.getElementById("tt").innerHTML = "<font color='red'>hello</font>说:<font color='blue' size=20>你好</font>";
  </script>
 </body>
</html>