title: Get Text of Form Field
body: <p>i'm a newbie to javascript.  i'm trying to make a form &amp; access the values of text fields.  that didn't work. so, i added a little test script to show an alert with just the value of the field.  that doesn't work either.  i'm following the docs and i can't figure out why it doesn't work.  i tried it several different ways. which i show as comments.  none of them worked.  any help greatly appreciated.</p>
  
  <pre><code>&lt;html&gt;
  
  &lt;head&gt;
  
  
  &lt;/head&gt;
  
  &lt;body&gt;
  
  &lt;script language="javascript" type="text/javascript"&gt;
  //&lt;!-- hide from older browsers
  
  alert("document.TalkNow.explain1")
  alert("HI")
  
  var stmtArray = new Array
  var permWords = new Array ["always","never"]
  var neutralWords = new Array ["sometimes","often","frequent"]
  var pervasiveWords = new Array ["every", "all", "each"]
  var localWords = new Array ["some", "few"]
  var internal = new Array ["I","me"]
  var external = new Array ["He", "She", "They"]
  var stories[3] = new Array
  
  
  // function Scrolling essage Footer
  function parseExplain(){
      //alert(document.forms[0].elements[0])
  
  }
  
  
  // parser function
  
  //--&gt;
  &lt;/script&gt;
  
  &lt;script language="javascript" type="text/javascript"&gt;
  //&lt;!-- hide from older browsers
  
  //var text=document.getElementById("TalkNow").elements[0].value
  //var text=document.getElementById("TalkNow").elements[0].value
  //var text=document.forms["TalkNow"]["explain1"].value
  //alert(text)
  
  //alert(document."TalkNow".explain1.value)
  //alert(document."TalkNow".elements[0].value)
  //alert(document.form[0].elements[0])
  
  
  
  //--&gt;
  &lt;/script&gt;
  
  &lt;p id="demo"&gt;&lt;/p&gt;
  
  &lt;form name="TalkNow" action="#"&gt;
   &lt;p&gt;
   &lt;h2&gt;What happened?&lt;/h2&gt;
   &lt;input type="textarea" name="event" size="80"&gt;
   &lt;/p&gt;
   &lt;h2&gt;How you explain this?&lt;/h2&gt;
   &lt;input type="text" name="explain1" size="80"&gt;
   &lt;input type="button" name="Assess" value="Evaluate" onClick="parseExplain()"&gt; 
   &lt;p&gt;
   &lt;h2&gt;What happened next?&lt;/h2&gt;
   &lt;input type="textarea" name="event" size="80"&gt;
   &lt;p&gt;
   &lt;h2&gt;How you explain this?&lt;/h2&gt;
   &lt;input type="text" name="explain2" size="80"&gt;
   &lt;input type="button" name="Assess" value="Evaluate"&gt; 
   &lt;p&gt;
   &lt;h2&gt;What happened after that?&lt;/h2&gt;
   &lt;input type="textarea" name="event" size="80"&gt;
   &lt;p&gt;
   &lt;h2&gt;How you explain this?&lt;/h2&gt;
   &lt;input type="text" size="80"&gt;
   &lt;input type="button" name="Assess" value="Evaluate"&gt; 
  &lt;/form&gt;
  
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>