hi, i am trying to reference session variables in javascript and cant work out
why i am getting an error:
the code i am getting an error on is:
for(i=1; i<="<cfoutput>#structcount(session.milestone)#</cfoutput>";i++)
{
alert("<cfoutput>#session.milestone[i].name#</cfoutput>");
}
the milestone array in the session structure contains 4 elements starting from
1-4. If i output the structcount it does say 4
however, running this code tells me that element 5 does not exist in the
milestone array. I am not even asking the loop to go as far as 5, i am just
telling it to go from 1 to 4.
if i test it with numbers instead of i then it works fine, as follows:
alert("<cfoutput>#session.milestone[1].name#</cfoutput>");
alert("<cfoutput>#session.milestone[2].name#</cfoutput>");
alert("<cfoutput>#session.milestone[3].name#</cfoutput>");
alert("<cfoutput>#session.milestone[4].name#</cfoutput>");
this works fine. does anyone have any idea why it is coming up with the error
on element 5 when the loop only goes from 1 to 4
even if i place a loop going from 1 to 2 it still says element 5 doesnt exist
i would appreciate any help or suggesstions
thanks
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four
times a year.
http://www.fusionauthority.com/quarterly
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:258764
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4