Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
Password Reminder
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 10th, 2005, 12:19 PM
Authorized User
Points: 373, Level: 6
Points: 373, Level: 6 Points: 373, Level: 6 Points: 373, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Sep 2004
Location: , , .
Posts: 68
Thanks: 1
Thanked 0 Times in 0 Posts
Default Checkboxes--number written to screen

Good morning.

I have a program in which I write various numbers of checkboxes to the user's screen. The number of checkboxes written varies depending on the content written from the database. The form will have all sorts of items written to it: checkboxes, dropdown lists, text boxes, etc.

Is there a way in JavaScript to "count" the total number of checkboxes written to the screen? I need to loop through all of the checkboxes that I write to the screen.

Thank you!

Reply With Quote
  #2 (permalink)  
Old January 10th, 2005, 12:40 PM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts

No direct way but:
function getInputsByType(Type)
  var colInputs = document.getElementsByTagName("input");
  var arrTargets = new Array():
  var sType = Type.toLowerCase();
  for (var i = 0; i < colInputs.length; i++)
    var oInput = colInputs[i];
    if (oInput.type.toLowerCase() == sType)
  return arrTargets;
 var arrCheckboxes = getInputsByType("checkbox")
var arrTextboxes = getInputsByType("text")


Joe (Microsoft MVP - XML)
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can a program be written so that? Joe Gelso Other Programming Languages 1 November 8th, 2007 10:13 PM
arabic language written from left to right !!! seco Dreamweaver (all versions) 0 April 3rd, 2007 01:58 PM
What langauge was this app written in? flavour404 Other Programming Languages 14 March 8th, 2007 11:37 AM
Draw on the screen without clearing the screen pu132 Visual Basic 2005 Basics 0 August 25th, 2006 09:03 PM

All times are GMT -4. The time now is 05:17 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.