Mega Code Archive

 
Categories / JavaScript Tutorial / Form
 

Text onSelect

The onSelect event handler is fired when the text in the box is highlighted. <html>     <head>     <script language="JavaScript">     <!--     function setText(){       document.myForm.myText2.value = document.myForm.myText1.defaultValue;     }     -->     </script>     </head>     <body>     <form name="myForm">       <input type=TEXT value="Change Me?" name="myText1" onSelect='setText()'>       <br>       <input type=TEXT value="" name="myText2">     </form>     </body>     </html>