I've used a new function. It is not optimized . I've used a new function. There you can fetchthe checkbox status in a loop. But my code works. Just copy and paste and see the changes
<script type="text/javascript">
function subscribe_to_all() {
for (i=0;i<document.mailer.subscriptions.length;i++){
document.mailer.subscriptions[i].checked = true;
}
}
function subscribe_to_none() {
for (i=0;i<document.mailer.subscriptions.length;i++){
document.mailer.subscriptions[i].checked = false;
}
}
function radio_yes() {
document.getElementById("subscribe").checked = true;
}
function radio_uncheck()
{
c1=document.getElementById("c1").checked;
c2=document.getElementById("c2").checked;
c3=document.getElementById("c3").checked;
c4=document.getElementById("c4").checked;
c5=document.getElementById("c5").checked;
c6=document.getElementById("c6").checked;
console.log(c1);
if(c1==false && c2==false && c3==false && c4==false && c5==false && c6==false)
{document.getElementById("subscribe").checked=false;}
//document.getElementById("subscribe").checked=false;
}
</script>
<fieldset>
Subscribe to our Mailing List?
<input type = "radio" name = "yes" id = "subscribe" onclick = "subscribe_to_all();" value = "yes" />Yes
<input type = "radio" name = "no" id = "no_subscribe" onclick = "subscribe_to_none();" value = "no" />No
</fieldset>
<fieldset name = "subscribe">
<legend>Mailing List Subscriptions</legend>
<input type="checkbox" id = "c1" name="subscriptions" onclick = "radio_yes();radio_uncheck();" value="CorporateEmails"/>
Corporate Press Release Emails<br />
<input type="checkbox" id = "c2" name="subscriptions" onclick = "radio_yes();radio_uncheck();" value="SoftwareAdvertising"/>
Upgrade Software Advertising List<br />
<input type="checkbox" id = "c3" name="subscriptions" onclick = "radio_yes();radio_uncheck();" value="PostBuyoutSpammers"/>
List given to spammers after buyout<br />
<input type="checkbox" id = "c4" name="subscriptions" onclick = "radio_yes();radio_uncheck();" value="NonCynical"/>
The only non-cynical list<br />
<input type="checkbox" id = "c5" name="subscriptions" onclick = "radio_yes();radio_uncheck();" value="SelltoSpammers"/>
List to sell to spammers<br />
<input type="checkbox" id = "c6" name="subscriptions" onclick = "radio_yes();radio_uncheck();" value="SpamList"/>
Spam List<br />