首页javascriptselectJavascript Form - 如何处理TextArea的所选/突出显示的事件

Javascript Form - 如何处理TextArea的所选/突出显示的事件

我们想知道如何处理TextArea的所选/突出显示的事件。


<html>
<head>
    <script language="JavaScript">
    function setText(){
      document.myForm.myTextArea2.value = document.myForm.myTextArea1.defaultValue;
    }
    </script>
</head>
<body>
    <form name="myForm">
       <textarea name="myTextArea1" rows=2 cols=50 onSelect='setText()'>
       Here is some text in my text area.
       </textarea>
       <br>
       <textarea name="myTextArea2" rows=2 cols=50>
       </textarea>
    </form>
</body>
</html>