Hi Franco!
You will never reach any code inside the for-block
If i=1 i can't be 31
I think you ment:
for(i=1;i<=31;i++)...
if you use elements[...] a string inside the brackets is expected. Therefore
you simply need to concat the two substrings. If "MornHourArr" is a constant
string:
if(FormButton.elements["MornHourArr"+i].value>23)
Greetings Hans
----- Original Message -----
From: "Franco" <francO.perretta@c...>
To: "javascript" <javascript@p...>
Sent: Monday, January 15, 2001 6:18 PM
Subject: [javascript] JScript Sintax (Elements)
> Hi,
> Some one could help me about the sintax in the ELEMENTS line.
> I can not join the name of the ELEMENTS and the variable i.
> I will appreciate your help
>
> Franco
>
> file://-----------------------------------------------------------------
> var i;
> function SumMorn()
> {
>
> for (i=1; i=31; i++)
>
> if (FormButton.elements["'MornHourArr' + i + '"].value>23)
> {
> alert("Vous aviez entre un horaire inexistent");
> FormButton.elements["'MornHourDep' + i + '"].focus();
> }
> else
> FormButton.elements["'MornHourTot' + i + '"].value
> FormButton.elements["'MornHourDep' + i + '"].value -
> FormButton.elements["'MornHourArr' + i + '"].value;
>
> }
> }
> file://-------------------------------------------------------
>