I am creating radio buttons with the code below.
Visitor has to choose one thing with JavaScript.
How do I do? I am inexperienced. Please, Can you give me an example one of codes?
function validateForm(frm){
var radios=frm.secilenlnbtipi_id; //radio button as an array-like object
var n=radios.length; //the total number of radio buttons
for(var i=0; i<n; i++){
if(radios[i].checked]) return true;
}
alert('You must choose one item");
return false;
}
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1254">
<script type="text/javascript">
function validateForm(frm){
var radios=frm.secilenlnbtipi_id; //radio button as an array-like object
var n=radios.length; //the total number of radio buttons
for(var i=0; i<n; i++){
if(radios[i].checked]) return true;
}
alert('You must choose one item");
return false;
}
</script>
</head>
Ok First of all learn to close your input tags
<input type="something" />
Then for groups, just change the name in <input> like ...
HTML Code:
<p>Member for group 1<input type="radio" value="v1" name="group1"></input></p><p>Member for group 1<input type="radio" value="v1" name="group1"></input></p><p>Member for group 2<input type="radio" value="v1" name="group2"></input></p><p>Member for group 2<input type="radio" value="v1" name="group2"></input></p><p>Member for group 3<input type="radio" value="v1" name="group3"></input></p><p>Member for group 3<input type="radio" value="v1" name="group3"></input></p>
Bookmarks