Kod:
<!DOCTYPE HTML>
<html>
<head>
<**** charset="UTF-8">
<title>www.bilisimogretmeni.com</title>
<script type="text/javascript">
function kontrol(form){
var hata = [];
if ( !radiokontrol(form.kahvesec) ) {
hata[hata.length] = "Kahvenizi nasıl içeceksiniz";
}
if (hata.length > 0) {
reportErrors(hata);
return false;
}
//www.bilsimogretmeni.com
return true;
}
function radiokontrol(radioButtons){
for (var i=0; i < radioButtons.length; i++) {
if (radioButtons[i].checked) {
return true;
}
}
return false;
}
//www.bilsimogretmeni.com
function reportErrors(hata){
var msg = "Hataları düzeltip tekrar deneyinn";
var numError;
for (var i = 0; i<hata.length; i++) {
numError = i + 1;
msg += "\n" + numError + ". " + hata[i];
}
alert(msg);
}
</script>
</head>
<body>
<h1>Kahve Sipariş Formu</h1>
<form method="post" action="islem.html"
onsubmit="return kontrol(this);">
<strong>Kahvenizi nasıl içersiniz?</strong>
<input type="radio" name="kahvesec" value="Sade"> Sade
<input type="radio" name="kahvesec" value="Orta Şekerli"> Orta Şekerli
<input type="radio" name="kahvesec" value="Şekerli"> Şekerli
<input type="radio" name="kahvesec" value="Kafve Sevmem Ben"> Kafve Sevmem Ben
<br><br>
<input type="submit" value="Siprariş ver">
</form>
</body>
</html>