File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes how to load HTML in DIV Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "how to load HTML in DIV" Watch "how to load HTML in DIV" New topic
Author

how to load HTML in DIV

accnit Jai
Ranch Hand

Joined: Feb 15, 2011
Posts: 33
I have one JSP page with two DIVs , one DIV to display the content and other to work as menu. In content DIV, I want to load the external HTML page. and I need to call some Java script function of content HTML (loaded in content DIV) to perform some function. When i am using :
document.getElementById("content").innerHTML =xmlhttp.responseText

innerHTML does not return the HTML page.

Can someone please let me know how I can load external HTML in my content DIV and also i can access their Java script function.

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61601
    
  67

An HTML Page? As in, complete with the <html> tag and everything? If so, then you cannot. It is not valid to include an <html> element anywhere inside the DOM.

If you meant an HTML fragment, that's different.

Which do you mean?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
accnit Jai
Ranch Hand

Joined: Feb 15, 2011
Posts: 33
DIV content will have the linked to Javascript , CSS files and images.. no HTML tag.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61601
    
  67

The just an HTML fragment, not a "page" (for that, you'd have to use an iframe).

So now you need to explain how you are "loading" the fragment and what you mean by "innerHTML does not return the HTML page".

And, this doesn't seem like a JSP problem at all, so I've moved this to the HTML forum.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to load HTML in DIV