Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: Checking and Unchecking Checkboxes in

by misc (Pilgrim)
on Aug 17, 2007 at 14:21 UTC ( #633302=note: print w/replies, xml ) Need Help??

in reply to Checking and Unchecking Checkboxes in

Your question is really not perl related, however, here is some javascript which implements what you seem to ask for.

I've tested in Konqueror, Firefox and IE.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http:/ +/"> <html> <head> <title></title> <meta name="GENERATOR" content="VIM"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script language="JavaScript"> var twofastest; var checkboxes=[]; function initVars(){ if ( twofastest ) return; twofastest = document.getElementById('twofastest'); var cb = document.getElementsByName('progname'); var b = 0; for (var a=0; a<cb.length; a++ ){ if ( cb[a] != twofastest ){ checkboxes[b] = cb[a]; b++; } } } function checkBoxClick(){ initVars(); var anyboxchecked = false; for (var a=0; a<checkboxes.length; a++ ){ if ( checkboxes[a].checked ) anyboxchecked = true; } twofastest.disabled = anyboxchecked; } function twofastestClick(){ initVars(); for (var a=0; a<checkboxes.length; a++ ){ if ( twofastest.checked ) checkboxes[a].checked = false; checkboxes[a].disabled = twofastest.checked; } } </script> </head> <body> <form action=""> <input type="checkbox" name="progname" value="2fastest" id="twofas +test" onClick="twofastestClick()">2 Fastest<br/> <input type="checkbox" name="progname" value="mitra" onClick="checkBoxClick()" />Mitra <br/> <input type="checkbox" name="progname" value="space" onClick="checkBoxClick()" />Space <br/> <input type="checkbox" name="progname" value="meme" onClick="checkBoxClick()" />Meme <br/> </form> </body> </html>

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://633302]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2018-05-24 02:44 GMT
Find Nodes?
    Voting Booth?