vhg119 wrote:
> Is there a way to create a DOM document object to hold the contents of
> an external html?
>
> I have two pages:
> content.html contains some content.
> index.html would like to access the contents of a particular <div> with
> an id of "important" within content.html.
>
> how would I do this? I know I can hack around and load the
> content.html in an iframe embedded in index.html. Then, I can make the
> iframe not visible. But, If theres a better way to do this (an easier
> way), I'd much rather take that approach.
>
> Vince
If content.html is valid xhtml(xml), then you could parse the document
like an xml file.
http://www.google.com/search?q=javascript+parse+xml
The other alternitive is to have a server page parse the document and
return the content you want. You could do this dynamicly using the
XmlHttpRequest object, or even simpler using
var s = document.createElement("script");
s.src = "http://www.u.com/getpage.php?u=<url>&d=<id of div>";
the getpage file could open the resource in $u and search for a div
with an id of $d
- JS
Received on Mon May 1 05:26:06 2006