CodeChargeMVP
Posts: 473
|
| Posted: 09/13/2010, 9:25 AM |
|
Javascript code on load form event:
array = nameoftheform.nameofthelistbox.options;
nameoftheform.nameofthelistbox.selectedIndex = 1:
alert(array.lenght); ---> the value is 17 elements on the array listbox
//according to progamming theory i´d start the for from i=1,but if i do that the
//selected element is deleted so i should start from i=2, I don´t know why
//theoy says than all arrays start from 0.
for(i=2;i<=array.lenght;i++)
{
alert(i);
array = null;
}
For only deletes the first 9 elements from the array listbox,
when it should delete 16 elements and left there the first one which is the selected
¿anybody knows why? Neither do i.
Great CCS. You make my live easyer every day.
_________________
Best Regards
Entrepeneur | NT Consultant
|
 |
 |
andy
Posts: 183
|
| Posted: 09/14/2010, 9:02 AM |
|
Is it because there two typos:
alert(array.lenght);
change to:
alert(array.length);
for(i=2;i<=array.lenght;i++)
change to:
for(i=2;i<=array.length;i++)
_________________
Andy
RAD tools for rich UI controls:
http://www.koolphptools.com |
 |
 |
CodeChargeMVP
Posts: 473
|
| Posted: 09/15/2010, 3:25 AM |
|
Sorry for the misspelled transcription,
the code is not pasted,
I writed again here and I misspelled,
so it´s length all the time,
because it´s only a way to know the length from an array
¿isn´t it?
So it does a really strange behaviour.
Quote andy:
Is it because there two typos:
alert(array.lenght);
change to:
alert(array.length);
for(i=2;i<=array.lenght;i++)
change to:
for(i=2;i<=array.length;i++)
_________________
Best Regards
Entrepeneur | NT Consultant
|
 |
 |
|