文本域换行的问题~~请高手指点
我想要的效果是   :   判断到30个字   就有一个 <br>    如果点回车也输入到数据库里一个 <br>
------解决方案-------------------- <div id= "jia ">  
  <textarea type= "text " name= "txt " id= "txt " style= "width:300px;height:200px; " onkeyup= "chk(); ">  
 文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字 </textarea>  
  <input type= "button " value= "check " onclick= "chk(); ">  
  </div>    
  <script language= "javascript ">  
 function chk(){ 
 	var txt = document.getElementById( "txt "); 
 	txt.value = txt.value.replace(/(.{30})/g, "$1\n ").replace(/\n/g, " <br>  "); 
 } 
  </script>