List Info

Thread: DOM FAQ




DOM FAQ
user name
2006-03-28 05:41:30
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

DOM FAQ
user name
2006-03-29 18:38:51
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 <getlouisyahoo.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 <getlouisyahoo.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/

DOM FAQ
user name
2006-03-29 18:50:39
Garrett Smith wrote:
> getElementsByTagName('body').item(0);
> 
> (or for better performance)
> 
> getElementsByTagName('body')[0];

For what it's worth, I believe the former is a tiny little
bit faster 
than the latter in Gecko, though the difference is pretty
minuscule.

-Boris

DOM FAQ
user name
2006-03-30 08:46:32
Le Wed, 29 Mar 2006 21:38:51 +0300, Garrett Smith
<dhtmlkitchengmail.com>  
a écrit:

> 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?
>
<...>
>
> On 3/27/06, louis joseph <getlouisyahoo.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

Is this the right mailing list for getting help? Isn't this
mailing list  
for discussing the specs, instead of "plz help
me"?


-- 
http://www.robodesign.ro
ROBO Design - We bring you the future

[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )