473,507 Members | 8,054 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Unchecking specified checkboxes in a table

2 New Member
I have a table with 12 checkboxes. I have the following function which when I check the last checkbox in the table, the first 10 checkboxes in the table are unchecked. -

function modify_boxes(to_be_checked,total_boxes){ for ( i=0 ; i < total_boxes ; i++ ){ if (to_be_checked){ document.forms[0].x[i].checked=true; } else{ document.forms[0].x[i].checked=false; } } }

I have the following in 'onclick' on the last checkbox in the table -

modify_boxes(false,10)

What I would like to happen, is when the first checkbox in the table is checked, that only the last two checkboxes in the table are unchecked. However the names of the checkboxes must all be 'x' as they are referenced elsewhere

thanks in advance
Mar 6 '07 #1
2 1707
acoder
16,027 Recognized Expert Moderator MVP
Geovanni, welcome to The Scripts.

Just use the same method, onclick and call a function:
Expand|Select|Wrap|Line Numbers
  1. function modifyLastTwo(checked) {
  2. var len = document.forms[0].x.length;
  3. document.forms[0].x[len-2].checked=checked;
  4. document.forms[0].x[len-1].checked=checked;
  5. }
with checked being either true or false, depending on the value of the first checkbox.
Mar 6 '07 #2
Geovanni Cesar
2 New Member
thanks a lot
Mar 6 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
6593
by: Mike Lopez | last post by:
Hello. I need to set a checkbox to the "checked" state and prevent the user from unchecking it. I tried using "disabled", but then the value is not passed on the Post to an ASP page. Anyone...
1
2283
by: Lumpierbritches | last post by:
Thank you in advance for any and all assistance. It is GREATLY appreciated. I have a ckPrint box that is used to select print items. I would like to know, how I can programatically uncheck ALL...
2
3178
by: john | last post by:
I posted this question to comp.lang.javascript but didn't get a response, so I'll try here. I am using ASP.NET and I have a datagrid. One of the columns in my grid is all checkboxes. When the...
3
4120
by: winky10 | last post by:
From a newbie. MSAccess 2000. I have a form with checkboxes and text boxes bound to their respective fields in a table. Using a query, I am able to create a report based on those checked boxes. ...
1
3005
by: TechnoAtif | last post by:
Hi to all. I have got a form containing of checkboxes along with other items. I have simply no clue as to (i) how to make entry for those checkbox data into the mysql table . I mean : what query...
3
2683
by: Silgd1 | last post by:
Hey All... I have visual web jsf page, developed in netbeans 6.0, and it has a layout panel which contains three(3) checkboxes of the woodstock component variety. If a user checks one of the...
1
1839
Death Slaught
by: Death Slaught | last post by:
I play a game that when your backpack fills with items (the limit is 45) you must choose items to discard by unchecking their box. This is very annoying and time consuming so I was wondering if it...
3
1564
by: sakkat | last post by:
Hi, I should have a table with 2 columns in it, the first column will contain 10 checkboxes(the number is not fixed it changes dynamically) and a button(move) and the second column will be empty,...
0
7223
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7110
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7372
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7030
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7482
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5623
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5041
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3191
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.