<html> <body> <script language="JavaScript"> function function2() { document.all.myTextArea.select(); } </script> <textarea id=myTextArea>Some text</textarea> <input type="button" value='Select the textarea' onclick="function2()"> </body> </html>