A przycisk typu image jest zgodny ze specyfikacją? Ja o tym nie słyszałem...
Ja bym tę walidację zrobił tak:
Kod: Zaznacz cały
<html>
<script type="text/javascript">
<!--
function verify(form)
{
var msg = '';
var ctrl = null;
if (form.student.value=="") {
msg ='Nie wypelniono pola student\n';
if (!ctrl) ctrl = form.student;
}
if (form.content.value=="") {
msg += 'Nie wypelniono pola content';
if (!ctrl) ctrl = form.content;
}
if (msg!='')
{
alert(msg);
ctrl.focus();
write.innerHTML="Wiadomość nie została wysłana.<br/>!Formularz nie został poprawnie wypełniony!";
return false;
}
return true;
}
//-->
</script>
<body>
<form method="get" onsubmit="return verify(this);">
<select name="chooseteacher" class="message-to-teacher-put">
<option>teacher1</option>
<option>teacher2</option>
<option>teacher3</option>
</select>
Podaj swój adres email:
<input class="message-to-teacher-put" type="text" name="student" size="9" maxlength="12"/>
Podaj treść wiadomości:<br/>
<textarea class="message-to-teacher-put" type="text" wrap="off" name="content" rows="8" cols="32"></textarea><br/>
<input type="submit" name="Send" value="Wyślij" title="Wyślij"/>
<div id="write"/>
</form>
</body>
</html>