Re: DOM FAQ

The most important thing I could suggest is to stop following the
sheeple. But you're probably being instructed by your boss to use
everybody's favorite buzzword and don't have a choice, right?

So taking a look at your code...

getElementsByTagName returns a NodeList. -->
http://www.w3.org/TR/DOM-Level-3-Core/

I assume you want a node, right?

I further assume that you want the 0th node, right?

If "sourceCode" were a node, then you could get the body tag like this:

getElementsByTagName('body').item(0);

(or for better performance)

getElementsByTagName('body')[0];

However, you indicated that "sourceCode" is actually a string (you
called this "text"). So you're trying to call a node method on a
string and you wanna know why it doesn't work, right?

Look, Stupid trends come and go. Well-designed code lasts. I'd suggest
anyone who wants to use AJAX to first read up on the DOM thoroughly,
study WAI docs, learn OOP, learn some server-side programming, and
build a few webapps with out using XMLHTTP/remote scripting.

Garrett




On 3/27/06, louis joseph <getlouis@yahoo.com> wrote:
>
> Hello All,
> I have a query,
> Using AJAX I'm trying to get source code of two  webpages and want to put
> the content of both pages in one page
> With AJAX i'm able to get the source code as text,within that text i need to
> get the body content
> if i use sourceCode.getElementsByTagName('body').innerHTML  i'm not getting
> proper result as this method is of document object
> plz help me regarding this issue
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com


--
http://dhtmlkitchen.com/

On 3/27/06, louis joseph <getlouis@yahoo.com> wrote:
>
> Hello All,
> I have a query,
> Using AJAX I'm trying to get source code of two  webpages and want to put
> the content of both pages in one page
> With AJAX i'm able to get the source code as text,within that text i need to
> get the body content
> if i use sourceCode.getElementsByTagName('body').innerHTML  i'm not getting
> proper result as this method is of document object
> plz help me regarding this issue
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com


--
http://dhtmlkitchen.com/

Received on Wednesday, 29 March 2006 18:39:00 UTC