CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> General/Other

 [UNRESOLVED - STRANGE JAVASCRIPT BEHAVIOUR]

Print topic Send  topic

Author Message
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
View profile  Send private message
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
View profile  Send private message
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
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.