Text.select() : Text Object : Form JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Form » Text Object »

 

Text.select()







The select() method selects the text in the text box.












<html>
    <head>
    <script language="JavaScript">
    <!--
    function selectText(){
      document.myForm.myText.select();
      document.myForm.myText.focus();
    }
    -->
    </script>
    </head>
    <body>
    <form name="myForm">
      <input type=TEXT value="hello world" name="myText">
      <input type=BUTTON value="Click to Select Text" name="myButton" onClick="selectText()">
    </form>
    </body>
    </html>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Form
» Text Object