Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: Limiting Arrays


Message #1 by "Tom Lynch" <tlynch@e...> on Thu, 21 Jun 2001 17:29:54
try grouping your check boxes or covert them into select boxes.
You have too many on one page...Maybe you should split the questions  pages.
If this is a survey or a quiz, who one actually sit there and take it.  Even
if you had 50 questions, with 7 possibilities, this is way too long.  

or....

when referencing you element, try naming them as...

document.formName.ChkBoxName

Then create a loop to find all elements with "chk" on the prefix. 

-----Original Message-----
From: Tom Lynch [mailto:tlynch@e...]
Sent: Thursday, June 21, 2001 1:30 PM
To: javascript
Subject: [javascript] Limiting Arrays


I am using a form collection to find checkboxes on my page (there are 
about 350 of them) - my question is how can i limit the array - currently 
i am using 

for (var i = 0; i < document.form1.elements.length; i++)
{
    var e = document.form1.elements[i];


the problem is there are too many items in the form so this is rather 
slow - how can i limit the array to (type == 'checkbox') or (className 
=='class')



  Return to Index