charbort
01-27-2003, 03:03 PM
Still learning, but I think this code cycles through to see which checkboxes are selected and sets the value to the input value, but how do I make it only alert if they don't check any checkboxes?
Thanks,
charbort
function CheckValues(){
var Rtn = false
if(document.signUp.subject1.checked == true){
alert(document.signUp.subject1.value);}
if(document.signUp.subject2.checked == true){
alert(document.signUp.subject2.value);}
if(document.signUp.subject3.checked == true){
alert(document.signUp.subject3.value);}
if(document.signUp.subject4.checked == true){
alert(document.signUp.subject4.value);}
if(document.signUp.subject5.checked == true){
alert(document.signUp.subject5.value);}
return Rtn;
------ HTML CODE -----
<form name="signUp" method="POST" action="FormMail.cgi" onSubmit='SubmitForm(this);'>
<input name='subject1' type='checkbox' value='Subscribe 1'>
<input name='subject2' type='checkbox' value='Subscribe 2'>
<input name='subject3' type='checkbox' value='Subscribe 3'>
<input name='subject4' type='checkbox' value='Subscribe 4'>
<input name='subject5' type='checkbox' value='Subscribe 5'>
Thanks,
charbort
function CheckValues(){
var Rtn = false
if(document.signUp.subject1.checked == true){
alert(document.signUp.subject1.value);}
if(document.signUp.subject2.checked == true){
alert(document.signUp.subject2.value);}
if(document.signUp.subject3.checked == true){
alert(document.signUp.subject3.value);}
if(document.signUp.subject4.checked == true){
alert(document.signUp.subject4.value);}
if(document.signUp.subject5.checked == true){
alert(document.signUp.subject5.value);}
return Rtn;
------ HTML CODE -----
<form name="signUp" method="POST" action="FormMail.cgi" onSubmit='SubmitForm(this);'>
<input name='subject1' type='checkbox' value='Subscribe 1'>
<input name='subject2' type='checkbox' value='Subscribe 2'>
<input name='subject3' type='checkbox' value='Subscribe 3'>
<input name='subject4' type='checkbox' value='Subscribe 4'>
<input name='subject5' type='checkbox' value='Subscribe 5'>