Javascript ile Radio Button seçilmedi kontrolü. Radio button validation control with javascript.

 

 

<script>
function kontrol(){
var radiourun = document.getElementsByName(“marka”);
var radioadet ;
radioadet = radiourun.length;

var value;

value = “” ;
for (var i = 0; i < radioadet; i++) {
if (radiourun[i].checked) {
value = radiourun[i].value;
}

}

alert(value);

if (value == “” ){
alert(‘secmediniz’);
return false ;
}
return true ;
}

 
</script>
<form action=”” method=”POST” >
<input type=”radio” name=”marka” id=”marka” value=”Male” />Male
<input type=”radio” name=”marka” id=”marka” value=”Female” />Female
<input type=”radio” name=”marka” id=”marka” value=”UniSex” />UniSex
<input type=”submit” value=”Gönder” onclick=”return kontrol();” name=”kaydet” id=”kaydet” >
</form>

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)