php-mysql tutorial

Designed By NISHANT GUPTA

  • Home
  • PHP
  • HTML
  • CSS
  • JavaScript
  • JQuery
  • Contact-us
  • Learn HTML

    • Introduction of HTML
    • Image Handling in HTML
    • List Handling in HTML
    • Font Handling in HTML
    • Table Handling in HTML
    • Form Handling in HTML
  • Learn CSS

    • Introduction of CSS
    • Styling Background in CSS
    • Styling Text in CSS
    • Styling Font in CSS
    • Styling Link in CSS
    • Styling List in CSS
    • Styling Table in CSS
    • Styling Div in CSS
    • Styling Span in CSS
    • Positioning in CSS
    • Display in CSS
  • Learn JavaScript

    • Introduction of JavaScript
    • Data Type in JavaScript
    • Variable in JavaScript
    • Oprator in JavaScript
    • Cond. Statement in JavaScript
    • Loop in JavaScript
    • Array in JavaScript
    • Function in JavaScript
    • Date in JavaScript
    • String in JavaScript
    • DOM in JavaScript
    • Event Handling in JavaScript
    • Form Handling in JS
  • Learn PHP-MYSQL

    • Introduction of PHP
    • Decision Control in PHP
    • Loop in PHP
    • Array in PHP
    • Function in PHP
    • Form Handling in PHP
    • File Inclusion in PHP

Form Handling in JavaScript

Form Recap

  1. Forms allow users to interact with a Web page by being able to provide information to the system in a way that goes beyond simply pointing and clicking things with the mouse.
  2. They allow the user to provide feedback to the Web page.
  3. JavaScript is one of many ways to process and respond to user feedback by evaulating the information provided in the form by the user.

Accessing Form Object

To work with Form we need to access it in our JavaScript code.

This can be done in following ways:

  1. Using forms[ ] array.
  2. Using name of the form
  3. Using getElementById( ) method

The forms[ ] Array

  1. When the browser builds our web page then it stores all the form objects in an array.
  2. To a programmer this array is made available as a property of document object called forms.
  3. Hence by writing document.forms we get an array of all form objects on our web page
For Example

var myforms=document.forms;

Now in the above code saying:

myforms[0]   will give us access to first form

myforms[1]   will give us access to second form

and so on.

Using the “name” property

We can also access a form by using it’s name property value with document object.
For Example

<form name=“frmlogin” . . . . .>

. . . . .

</form>

Now in JavaScript we can access this form as:

var myform=document.frmlogin;

 

Advertisements

 

©  2014 All Rights Reserved  •  Design by >Nishant Gupta.

Privacy Policy • Terms of Use