This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes checkbox property Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "checkbox property" Watch "checkbox property" New topic

checkbox property

meghana maganti

Joined: Sep 13, 2005
Posts: 11
I have a group of checkboxes in my jsp page and i am trying to give
this part of code in javascript and using mozilla firefox browser but it complaines as the property length is "undefined"

for(var i=o; i<document.forms[0].ch_pk.length; i++) {

if(document.forms[0].ch_pk[i].checked == true) {

Marc Larochelle

Joined: Sep 16, 2005
Posts: 14
ch_pk is a checkbox?
What "length" sould return?
I don't think that you can "group" checkboxes, you can only do that with radio buttons no?
meghana maganti

Joined: Sep 13, 2005
Posts: 11
Hi Marc,

I am trying to display the checkboxes in a column when a list is iterated and checkbox lenght should return the number of checkboxes and from that i am trying to retrieve the ones that are checked in a JavaScript
I agree. Here's the link:
subject: checkbox property