I must have read about arguments in functions and how they are variables and/or objects and pass value a million times and still real life examples keep throwing me off. The keyword "this" in this example points to the object of the function, being the form element. OK got that.
Now the function outside the window.onload event handler has a parameter named "frm". My question is whether it's necessary to give this parameter the same name as the id of the form element that will be passed to it (in this case 'frm')? I thought this didn't matter. For all it mattered one could put anything inside the argument just as long as it's reused as a local variable inside of the function itself.
window.onload = function() {
// validation for submit button
document.frmFlight.onsubmit = function() {
//console.log("what is 'this'?: "+this);
return validate(this);
}
}
//----------------------------------------------------------
function validate(frm) {
var valid = true;
return valid;
}