direi
codice:
...
if (document.getElementById(marta) == null) {
 alert ('id errato');
 return false;
}