topical media & game development

talk show tell print

professional-javascript-11-RetrievingTextboxLengthsExample.htm / htm



  <html>
      <head>
          <title>Retrieving a Textbox Length Example</title>
          <script type="text/javascript">
              function getLengths() {
                  var oTextbox1 = document.getElementById("txt1");
                  var oTextbox2 = document.getElementById("txt2");
                  alert("The length of txt1 is " + oTextbox1.value.length + "\n" 
                       + "The length of txt2 is " + oTextbox2.value.length);
  
              }
          </script>
      </head>
      <body>
          <input type="text" size="12" id="txt1" /><br />
          <textarea rows="5" cols="25" id="txt2"></textarea><br />
          <input type="button" value="Get Lengths" onclick="getLengths()" />
      </body>
  </html>
  
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.