checking form with JS
THis is really starting to bug me. Such a simple procedure to check to see if the text fields are empty. This is what i have;
function CheckForm() {
var box = document.getElementsByTagName("input").type='text';
for(i=0;i<box.length;i++){
if(box[i].value == ""){
alert("you must fill in field "+box[i].name);
return false;
}else{
return true;
}
}
it doesnt work and i have no idea why. I can alert the amount of input fields i have, so the call to the function is fine.