<form action etc>
input
</form>
<form action etc>
input
</form>
var form = document.querySelectorAll('form');
for(var i=0;i<form.length;i++){
form[i].addEventListener('submit', validate, false);
}
function validate(){
...
};
Array.prototype.indexOf.call(document.forms, this)