Mega Code Archive

 
Categories / JavaScript Tutorial / Form
 

Retrieving Text in form button action

< html> <head> <title>Retrieving Text</title> <script language="javascript" type="text/javascript"> <!-- function alertText() {      var text = document.simpleForm.myText.value;      alert(text); } //--> </script> </head> <body> <h1>Retrieving Text</h1> <form name="simpleForm">   <input type="text" name="myText" size="20" />   <input type="button" value="Alert Text" onclick="alertText()" /> </form> </body> </html>