"Todd Cary" <todd@aristesoftware.com> wrote in message
news:RUCMd.5227$m31.67424@typhoon.sonic.net...[color=blue]
> If I execute
>
> var d = document.getElementById("menuBar");
> var c = d.childNodes;
> for (var i=0; i<c.length; i++) {
> alert(c.menu);[/color]
alert(c[i].menu);
[color=blue]
> }
>
> I get 3 strings and 6 undefined's (expected).
>
> If I execute
>
> var d = document.getElementById("menuBar");
> var c = d.childNodes;
> for (var i=0; i<c.length; i++) {
> if(c.menu)[/color]
if (c[i].menu)
[color=blue]
> alert(c.menu);[/color]
alert(c[i].menu);
[color=blue]
> }
>
> I get 3 strings and 2 undefined's.
>
> Confused! I only want the strings....[/color]
if ('string' == typeof c[i].menu)
Some of those childNodes will most likely be empty text nodes, which are
unlikely to have your -menu- property.
--
Grant Wagner <gwagner@agricoreunited.com>
comp.lang.javascript FAQ -
http://jibbering.com/faq