View Full Version : checkbox trouble

05-08-2006, 11:59 AM

I'm having trouble getting a set of checkboxes to hide/show some hidden info...

if there is more than 1 checkbox ticked, nothing will turn off again??!!!!

Any ideas what i need to do to cure this problem

Here's the source code (http://www.standardcraze.co.uk/test.htm)


05-08-2006, 12:23 PM
you gave some of your checkboxes the same name. Do you really need those names to be like that? You might get trouble when sending to the server. Can't u use something like this?

<input type="checkbox" name="group1_1" onclick="rev(0)">a) group1<br>
<input type="checkbox" name="group1_2" onclick="rev(0)">b) group1<br>
<input type="checkbox" name="group1_3" onclick="rev(0)">c) group1<br><br>

<input type="checkbox" name="group2_1" onclick="rev(1)">a) group2<br>
<input type="checkbox" name="group2_2" onclick="rev(1)">b) group2<br>
<input type="checkbox" name="group2_3" onclick="rev(1)">c) group2<br><br>

<input type="checkbox" name="group3_1" onclick="rev(2)">a) group3<br>
<input type="checkbox" name="group3_2" onclick="rev(2)">b) group3<br>

<input type="checkbox" checked name="group3_3" onclick="rev(2)">c) group3<br><br>

If so I might rebuild your code

05-08-2006, 12:44 PM
sorry, yes, i had changed the names once... i must have reverted back to an old version though.

I've updated the file now... if you could help me with my code, that would be great.


05-08-2006, 01:16 PM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<script type="text/javascript">

function rev(){
var c = document.getElementsByTagName('input');
var j=1;
for(var i=0;i<c.length;i++){

<div id="group1_d" style="visibility:hidden">Revealed from group 1</div>
<div id="group2_d" style="visibility:hidden">Revealed from group 2</div>
<div id="group3_d" style="visibility:hidden">Revealed from group 3</div>
<input type="checkbox" name="group1_1" onclick="rev()">a) group1<br>
<input type="checkbox" name="group1_2" onclick="rev()">b) group1<br>
<input type="checkbox" name="group1_3" onclick="rev()">c) group1<br><br>

<input type="checkbox" name="group2_1" onclick="rev()">a) group2<br>
<input type="checkbox" name="group2_2" onclick="rev()">b) group2<br>
<input type="checkbox" name="group2_3" onclick="rev()">c) group2<br><br>

<input type="checkbox" name="group3_1" onclick="rev()">a) group3<br>
<input type="checkbox" name="group3_2" onclick="rev()">b) group3<br>
<input type="checkbox" name="group3_3" checked onclick="rev()">c) group3<br><br>


05-08-2006, 01:31 PM
thats perfect.... thanks!

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum