选取文本域中的内容

  1. <html>
  2. <head>
  3. <script type="text/javascript">
  4. function selText()
  5. {
  6. document.getElementById("myText").select()
  7. }
  8. </script>
  9. </head>
  10.  
  11. <body>
  12. <form>
  13. <input size="25" type="text" id="myText" value="选定我吧!">
  14. <input type="button" value="选择文本" onclick="selText()">
  15. </form>
  16. </body>
  17.  
  18. </html>