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
2 1721 acoder 16,027
Recognized Expert Moderator MVP
Geovanni, welcome to The Scripts.
Just use the same method, onclick and call a function: - function modifyLastTwo(checked) {
-
var len = document.forms[0].x.length;
-
document.forms[0].x[len-2].checked=checked;
-
document.forms[0].x[len-1].checked=checked;
-
}
with checked being either true or false, depending on the value of the first checkbox.
Sign in to post your reply or Sign up for a free account.
Similar topics |
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,
|
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,
|
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...
|
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.
|
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....
| |
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
|
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...
|
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
|
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...
|
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,...
|
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...
| |
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,...
|
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...
|
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...
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |