function CheckForm() { var Form = document.Login; if( Form.email.value == "") { alert( "Bitte geben Sie Ihre E-Mail-Adresse ein." ); Form.email.focus(); return false; } if( Form.password.value == "") { alert( "Bitte geben Sie Ihr Passwort ein." ); Form.password.focus(); return false; } }
<form id="Login" method="post" onsubmit="return CheckForm();"> <table> <tr> <th>E-Mail-Adresse:</th> <td><input type="email" name="Benutzername" /></td> </tr> <tr> <th>Passwort:</th> <td><input type="password" name="Passwort" /></td> </tr> <tr> <th> </th> <td><input type="submit" name="submit" value="Login" /></td> </tr> </table> </form>