Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

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 the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2016-10-23 07:39 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (300 votes). Check out past polls.