473,664 Members | 2,770 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,tot al_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(fa lse,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 1721
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
6612
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 have any ideas? Thanks in advance,
1
2291
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 the checkboxes, once all the selected records are printed? I would also like to know if there is a way to determine which records were printed, and offer a reprint option, if it's not too difficult? Thank you again,
2
3188
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 user clicks on a certain button on the page, which is not in the grid, I want to be able to traverse through all the checkboxes in that column and see how many are checked. This is so that I can give them a confirmation dialog before I do an action...
3
4138
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. What I want to do is create a command button to clear those check boxes and text boxes after printing. I saw a similar post, but it didn't work for me. I'm sure there is a simple solution, but I can't figure it out.
1
3020
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 to put for creating field corresponding to checkboxes. Create table arc(status ---?) status is the array for checkboxes. what should be the data type and its length. (II)How to post data from the checkboxes correctly into the database on submit....
3
2696
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 checkboxes and then decides to check another, I want the previously checked checkbox to become unchecked. Is this possible?? Please provide some example code if it is. Thanks... Silgd
1
1850
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 were possible to create a Javascript function to be saved as a bookmark, and when used it prompts for the checkbox to start at (so it won't discard items that I want to keep) and discards all items after that point. So my main question is, is it...
3
1573
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, when the user will click on say about 2 checkboxes and clicks on the button(move) available in the first column, then the rest of the checkboxes should be moved to the next column with the checkboxes being checked. I hope am clear this time. Thanks
0
8438
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8348
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8863
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8549
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8636
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4186
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2765
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2004
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1761
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.