我想做的就是UBB标签,一个文本域上有个按钮叫“换行”,点击一下,下面的文本域里面就添加一个“<br>”怎么实现?小弟菜鸟哦,最好能给段代码

解决方案 »

  1.   

    我刚才试着写了一下,很简陋,楼主可以参考一下,希望能给楼主一点启发:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    <script type="text/javascript">
         function huanhang(){
    document.getElementById('demo').value += "\n";
    }
        </script>
    </head>
    <body>
    <input type="button" value="换行" onclick="huanhang()"/><br/>
        <textarea rows="30" cols="80" id="demo"></textarea>
    </body>
    </html>