If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

here in my code when alerting using the last stmt there are two scenarios, the first one is when the if statement condition doesn't achieved, and in this case the alerting gives me the desired result(the selected item), but when the if statement condition achieved, the alerting gives me undifined although i'm certain that the cats[j] is an element in the XML file.

You are not writing JavaScript, you are using a JQuery tool or similar.

STOP using $ prefix on JavaScript variable names...
Please remember to wrap any code you have in forum tags:- [CODE]...[/CODE] [HTML]...[/HTML] [PHP]...[/PHP]If you can't think outside the box, you will be trapped forever with no escape...