javascript怎么取得<textarea>标签里的值

解决方案 »

  1.   

    <textareacols="85" id="content" name="content" >textarea>
    alert(document.getElementById("content").value);
      

  2.   


    <html>
    <head>
    <title>test</title>
    <script type="text/javascript">
       function getAreaValue(){
    alert(document.getElementById("area1").innerHTML);
       }
       window.onload = getAreaValue;
    </script>
    </head>
    <body>
    <textarea id="area1">
    hello
    </textarea>
    </body>
    </html>
      

  3.   

    <html>
    <head>
    <title>test</title>
    <script type="text/javascript">
    $(function(){
    alert($("#area1").text());
    })
    </script>
    </head>
    <body>
    <textarea id="area1">
        hello
    </textarea>
    </body>
    </html>