JavaScript topics covered:
  1. radio buttons - when using radio buttons and you only want one checked, then you must give the buttons all the same name. Then when one is checked the others are not. If a button is checked then the value of the button will be true.
    if (document.forms[0].name4[0].checked == true) 
    	alert("0 is checked");
    
    Click here to see the example

    Radio buttons can be useful when creating a multiple choice questionaire, check out the name game...

    Name Game

  2. Some forms use buttons instead of submit, mainly because the submit will submit the form unless a return false is given to stop the form. So if you want a button on the form yet do not want the form to be submitted, use the button type. Buttons also have events. You could use a button to change an image.
    <INPUT TYPE="button" VALUE="Disk" 
    	onClick="document.programmer_pic.src='/images/character0.gif';">
    
    Click here to see the example

  3. Submit button - When you use the submit button the data on the form will be sent to to the URL specified in the action property. However if you use return false the form will not be submitted. In this example we are checking to see if the user typed all the required information. If not, then we do not want to send the form. If everything has been filled out, then send the form information to the next program.
    <input type="submit" name="validate" value="submit form" onClick="return IsFormComplete();">
    
    Click here to see the example

  4. Just because people have entered information on the form, you may want to test to make sure it has been entered correctly. If you are looking for a phone number, then you want to check to make sure the phone number is numeric. This demo checks for empty fields and if a phone number is entered, then checks the phone number.

    Click here to see the example