On Tue, 2004-02-17 at 20:21, Daevid Vincent wrote:
> Okay kids. Here's another strange one. Very simple form. The array is
> dynamically generated from PHP as per the suggested method:
> http://us2.php.net/manual/en/faq.html.php#faq.html.arrays
> 
> However, when there is only a single element, the myMultiSelect.length is
> undefined in javascript.
> If there are two or more elements, then the length works as expected...

This is a javascript question not a PHP question, but how about:
selectedAudits = 0;
if (myMultiSelect.length) {
  for(i = 0; i < myMultiSelect.length; i++)
    if (myMultiSelect[i].checked) selectedAudits++;
} else {
    if (myMultiSelect.checked) selectedAudits++;
}

-- 
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to