<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2600.0" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>I still have the increment and variable undefined
problem.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Here is my latest revision of the
code:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>var i = 0;<BR>var itemCheck = item0;
<BR>while(window.itemCheck) <BR>{ </FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>x = "item" + i;<BR>itemCheck =eval(x);</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>document.write("<A HREF=" + itemCheck + ">" +
itemCheck + "<BR></A>" );</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> i++; <BR>} </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Any help would be appreciated as this one is
driving me crazy.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>The .js file that I'm getting the variables from
has 2 items in it currently. </FONT></DIV>
<DIV><FONT face=Arial size=2>var item0 = "files/file1.html";<BR>var item1 =
"files/file2.html";</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Later it will have an unknown amount (that's why I
need the while statement).</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Thanks in advance,</FONT></DIV>
<DIV><FONT face=Arial size=2>hyper</FONT></DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=walter@torres.ws href="mailto:walter@torres.ws">Walter Torres</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=javascript@LaTech.edu
href="mailto:javascript@LaTech.edu">[JavaScript List]</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Saturday, May 24, 2003 1:10
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> RE: [Javascript] variable
undefined problem</DIV>
<DIV><BR></DIV>sure, increament *after* you get the item needed.<BR><BR>You
are doing it *before*<BR><BR>This means you will *never* get 'item0' and you
will always ask for ONE past<BR>the end.<BR><BR>walter<BR><BR><BR>>
-----Original Message-----<BR>> From: <A
href="mailto:javascript-bounces@LaTech.edu">javascript-bounces@LaTech.edu</A><BR>>
[mailto:javascript-bounces@LaTech.edu]On Behalf Of <A
href="mailto:hypersdc@cox.net">hypersdc@cox.net</A><BR>> Sent: Friday, May
23, 2003 11:48 AM<BR>> To: [JavaScript List]<BR>> Subject: Re:
[Javascript] variable undefined problem<BR>><BR>><BR>> Ok. But how
should I fix that. Any recommendations?<BR>> I'm trying to get the variable
values from the external file<BR>> without knowing<BR>> how many items
are in the list.<BR>><BR>> Thanks<BR>> ----- Original Message
-----<BR>> From: "Rodney Myers" <<A
href="mailto:rodney@aflyingstart.net">rodney@aflyingstart.net</A>><BR>>
To: "[JavaScript List]" <<A
href="mailto:javascript@LaTech.edu">javascript@LaTech.edu</A>><BR>>
Sent: Saturday, May 24, 2003 2:10 AM<BR>> Subject: Re: [Javascript]
variable undefined problem<BR>><BR>><BR>> > Hello,<BR>>
><BR>> > As the while loop starts with a valid itemCheck variable it
should cycle<BR>> > until the last valid variable.<BR>> > But
inside the loop you have<BR>> ><BR>> > x = "item" + i;<BR>>
> itemCheck =eval(x);<BR>> ><BR>> ><BR>> > if itemN was
the last valid item, and so permitted entry to the loop<BR>> > the N+1
is guaranteed to be undefined.<BR>> ><BR>> > hth<BR>>
><BR>> > Rodney<BR>> ><BR>> ><BR>> > <A
href="mailto:hypersdc@cox.net">hypersdc@cox.net</A> wrote:<BR>>
><BR>> > >I'm having problems with a variable undefined
error.<BR>> > ><BR>> > >I'm grabbing a set of variables from
a file (.js file). I'm cycling<BR>> through<BR>> > >the variables
with a while statement. The problem I'm having<BR>> is the last<BR>>
> >variable is getting an undefined. How can I fix the code so<BR>>
this doesn't<BR>> > >happen.<BR>> > ><BR>> >
>//Start Code:<BR>> > ><BR>> > >var i = 0;<BR>> >
>var itemCheck = item0;<BR>> > >while(window.itemCheck)<BR>>
> >{<BR>> > ><BR>> > > document.write("<A
HREF=" + itemCheck + ">" + itemCheck +<BR>> "<BR></A>"
);<BR>> > ><BR>> > > i++;<BR>> > >x =
"item" + i;<BR>> > >itemCheck =eval(x);<BR>> > ><BR>>
> >if (typeof eval(x) == 'undefined')<BR>> >
> alert('2 Undefined');<BR>> > >else<BR>>
> > alert('2 okay');<BR>> > >itemCheck
=eval(x);<BR>> > ><BR>> > ><BR>> > >}<BR>> >
><BR>> > ><BR>> > >//End code<BR>> > ><BR>>
> >//js content<BR>> > >var item0 = "name 1";<BR>> >
>var item1 = "name 2";<BR>> > ><BR>> > >//end js file
content<BR>> > ><BR>> > >Thanks in advance<BR>> >
><BR>> > >_______________________________________________<BR>>
> >Javascript mailing list<BR>> >
>Javascript@LaTech.edu<BR>> >
>https://lists.LaTech.edu/mailman/listinfo/javascript<BR>> >
><BR>> > ><BR>> > ><BR>> ><BR>> > --<BR>>
><BR>> > PS. I now have resale rights for Mike Chen's<BR>> >
BizAutomator. If you have to answer routine<BR>> > email queries from
your sites or mailings then<BR>> > you will find this simple-to-use
program invaluable.<BR>> > <A
href="http://www.BizAutomator.co.uk">http://www.BizAutomator.co.uk</A><BR>>
><BR>> ><BR>> ><BR>> ><BR>> ><BR>> ><BR>>
><BR>> ><BR>> >
_______________________________________________<BR>> > Javascript
mailing list<BR>> > <A
href="mailto:Javascript@LaTech.edu">Javascript@LaTech.edu</A><BR>> > <A
href="https://lists.LaTech.edu/mailman/listinfo/javascript">https://lists.LaTech.edu/mailman/listinfo/javascript</A><BR>><BR>>
_______________________________________________<BR>> Javascript mailing
list<BR>> <A
href="mailto:Javascript@LaTech.edu">Javascript@LaTech.edu</A><BR>> <A
href="https://lists.LaTech.edu/mailman/listinfo/javascript">https://lists.LaTech.edu/mailman/listinfo/javascript</A><BR><BR><BR>_______________________________________________<BR>Javascript
mailing list<BR><A
href="mailto:Javascript@LaTech.edu">Javascript@LaTech.edu</A><BR><A
href="https://lists.LaTech.edu/mailman/listinfo/javascript">https://lists.LaTech.edu/mailman/listinfo/javascript</A></BLOCKQUOTE></BODY></HTML>