W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2006

Re: DOM FAQ

From: Garrett Smith <dhtmlkitchen@gmail.com>
Date: Wed, 29 Mar 2006 10:38:51 -0800
Message-ID: <c9e12660603291038y4eb4666fy295d4f408132f467@mail.gmail.com>
To: "DOM mailing list" <www-dom@w3.org>

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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:58 GMT