KevinM1 Posted November 6, 2006 Share Posted November 6, 2006 Say I have the following html document:[code]<?php//using php in my code block because the board always breaks on me if I try using just html?><html><head><title>Blah</title></head><body><div>This chicken tastes <span style="font-weight: bold;">really</span> good.</div></body></html><?php//more php just to make sure the board doesn't break?>[/code]What would be the div's text node(s)? Would it be "This chicken tastes good?" Or would there be two text nodes because of the span ("This chicken tastes," and "good")? Quote Link to comment Share on other sites More sharing options...
Telemachus Posted November 6, 2006 Share Posted November 6, 2006 If you just accessed document.getElementsByTagName("div")[0].childNodes and looked for text nodes, there would be two, "This chicken tastes " and " good." document.getElementsByTagName("div")[0].childNodes[1].firstChild.nodeValue would be "really" so there are actually three text nodes inside of the div. Quote Link to comment Share on other sites More sharing options...
fenway Posted November 7, 2006 Share Posted November 7, 2006 Correct... anything between tags is "raw" text. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.