Error undifined array

OK I am noobie to JS and have receive an error i do not understand of array undifined line 3.

This is simply apart of a script to validate a form I know this is going to turn out to be something rookie, but I am a bit lost, any help would be much appriciated.

Code:
/* define a function to be called later by an onclick comand saving the submit comand for a php script later */
function notEmpty(){

// setsup an array with the required fields listed in it.
// this is the line I beleave that the error is refearing to.
var Element=new array(“mytext”,“mytext1”,“mytext2”);

// Sets up an array with to hold the required feilds that are empty.
var BadData=new array();

// Sets an integer so a for loop can read through the Elements array.
var i=0;

/* sets up an integer so the BadData array can be assigned empty required feilds from the Elements array. */
var v=0;

//runs through the arrays enering values into BadData array.
while (i<=2)
{
var myTextField = document.getElementById(“Element[i]”);
if(myTextField.value == “”)
{
BadData[v]=Ellement[i];
i++;
v++;
}
else
{
i++;
}
}

/* this part should display the fields that have not been field in*/
var BDCount=BadData.length;
if (BDCount>=1)
{
document.write(“please fill in the following feilds”);
for (x in BadData)
{
document.write(BadData + “<br />”);
}
}
else
{
//this is just for testing reasons.
alert(“the form is valid”);
}
}

I beleave the logich here should be sound but I have been wrong in the past. any help would be appriciated.

Try changing

var BadData=new array();

to

var BadData=new Array();

Awsome that got rid of that error, thanx SGT.

No problem