<script language=javascript> 
function getValue() 

document.form1.t1.value='aaa \n bbb \nccc'; 

</script> <form name=form1> 
<textarea name="t1" cols="40" rows="3"> </textarea> <BR> 
<input type=button value=getvalue onClick=getValue()> 
</form>

解决方案 »

  1.   

    <html> 
        <head> <title>jishu </title> 
    <script language=javascript> 
    function getValue() 

    var str = "aaa <BR>bbb <BR>ccc";
    var re = /<BR>/g
    var dstr = str.replace(re,"\n");
    document.form1.t1.value=dstr; 
    //alert(dstr)

    </script> 
          </head> 
          <body> 
    <form name=form1> 
    <textarea name="t1" cols="40" rows="3"></textarea> <BR> 
    <input type=button value=getgvalue onClick=getValue()> 
    </form>
        </body> 
        </html>