Accessing form elements

/ Published in: JavaScript
Save to your folder(s)

Copy this code and paste it in your HTML
  1. the value of a text box defined with the markup <input type="text" name="Name" /> can be accessed using the expression document.forms[0].elements["Name"].value
  2. OR
  3. <input type="button" onclick="ShowText(this.form);" />
  4. ... ShowText(f){f.elements["Name"].value}

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.