As far as I understand, the <p> inside the <div> should be its child, and in this case the first and last child. In that case, the script should alert "Hello" since it's the innerHTML of the <p> element.
Obviously I'm missing something and would love to be enlightened.
According to w3schools.com, apparently browsers other than Internet Explorer treat white spaces (including line feeds) as text nodes. See http://www.w3schools.com/dom/prop_el...firstchild.asp. So you're probably best off using a function similar to the one they give as an example in order to crawl the child elements to make sure you find the one you really want.