Form JavaScript Tutorial

First, use getElementById() and pass in the form's ID:

var oForm = document.getElementById("form1");
Alternately, you can use the document's forms collection and reference the form either by its position in the forms collection or by its name attribute:

var myForm = document.forms[0];               //get the first form
var myOtherForm = document.forms["formZ"];    //get the form whose name is "formZ"