473,586 Members | 2,702 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to count number of check boxes in a check box list.

hi,

i have a list of checkboxes, the number of checkboxes is dynamic. All
the checkboxes have same name.
i am trying to get the length of selected checkboxes.
<input type=checkbox name=name1 value=1>
<input type=checkbox name=name1 value=2>
........ get dynamically.

when i try to get the length in javascript like
document.form.n ame1.length,
it works fine if number of checkboxes selected are more than 1, but not
for 1.

any idea.
thanks.

Mar 29 '06 #1
1 4139
babu17 wrote:
hi,

i have a list of checkboxes, the number of checkboxes is dynamic. All
the checkboxes have same name.
i am trying to get the length of selected checkboxes.
<input type=checkbox name=name1 value=1>
<input type=checkbox name=name1 value=2>
....... get dynamically.

when i try to get the length in javascript like
document.form.n ame1.length,
it works fine if number of checkboxes selected are more than 1, but not
for 1.

any idea.


document.getEle mentsByName('na me1').length;

getElementsByNa me() always returns an HTMLCollection, even if there are no
elements with the specified name (i.e. the length is zero).
--
Rob
Mar 30 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

22
61359
by: Ling Lee | last post by:
Hi all. I'm trying to write a program that: 1) Ask me what file I want to count number of lines in, and then counts the lines and writes the answear out. 2) I made the first part like this: in_file = raw_input("What is the name of the file you want to open: ") in_file = open("test.txt","r")
10
4402
by: Henk Ernst Blok | last post by:
Hi Posgres users/developers, Can anyone explain why PosgreSQL (version 7.4.5 on Linux) does a full table scan to compute a count(*) on a base table after a vacuum analyze has been done with no following updates that might have outdated any statistics. Strangly the explain command does give the correct number of tuples instantaniously from...
7
9783
by: DP | last post by:
hi, how would u do a count for somthing that is checked, in a check box?? this is wat i've got so far, but its coming out with an error; =DCount("Available","tblFilm","='Checked'") i;ve tried changed checked to true, but its the same error. i'm trying to get it to count the number of checks in the boxes.
5
2088
by: Shreekant Patel | last post by:
Hello, I am new to the advanced level of access, and I have quite a few changes to make to an existing database. The current database's main form needs to have additional check boxes added to it which in turn are meant to be linked to relevant tables and a combo box which hold relevant data specific for it. E.g. If checkbox1 is...
2
2166
by: GoCoogs | last post by:
I'm trying to count how many items are in a dynamic collection. This is the code I have so far. *** Begin Code *** Public Class Rule Private _rulevars As RuleVarsCollection Private _rulename As String Public Property Name() As String Get
22
12448
by: MP | last post by:
vb6,ado,mdb,win2k i pass the sql string to the .Execute method on the open connection to Table_Name(const) db table fwiw (the connection opened via class wrapper:) msConnString = "Data Source=" & msDbFilename moConn.Properties("Persist Security Info") = False moConn.ConnectionString = msConnString moConn.CursorLocation = adUseClient...
5
6727
by: Andrew Meador | last post by:
I have a form (Change Card List by Status) with a check box (cboNOT) and a list box (lstStatus). There is an Open Report button that opens a report (Report - Change Card List) which uses a query (SQL -Change Card List). What I want to do is have the form open the report where a filter is set to use the values from the check box AND the...
9
2973
by: smarttechie | last post by:
Hii all please help its urgent i have developed an application in xsl. what i want to do is i m searching the xml file based on a search.and based on that search im creating one tree like structure. in this tree structure i need the count of siblings in each level. im not getting the count exactly the same the xslt file ----------------- ...
0
7911
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...
0
7839
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...
0
8338
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
8215
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...
0
5390
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3836
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...
0
3864
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2345
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
1
1448
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.