Hello,
This is not the optimal solution:
<script>
var s=
'<user>'+
' <exec>'+
' <entry>Value1</entry>'+
' <entry>Value2</entry>'+
' <entry>Value3</entry>'+
' <entry>Value4</entry>'+
' <exec/>'+
'<user/>';
var i, j, entry;
while(true)
{
i = s.indexOf('<entry>');
if (i == -1)
break;
s = s.substr(i+7); // chop off <entry>
j = s.indexOf('</entry>');
entry = s.substr(0, j);
alert(entry);
}
</script>
--
Elias
http://lgwm.org/
"sunsmurf" <jo***@yahoo.com> wrote in message
news:89**************************@posting.google.c om...
Hi
I'm a JavaSCript newbee and i've got a problem.
I do a search and get the following in xml:
<user>
<exec>
<entry>Value1</entry>
<entry>Value2</entry>
<entry>Value3</entry>
<entry>Value4</entry>
<exec/>
<user/>
How is the easiest way to find the number of entries in the array and
how can iterate over each value to test if the given value matches
another variable?
Thanks
JT