Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to load HTML in DIV

 
accnit Jai
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64717
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
accnit Jai
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
DIV content will have the linked to Javascript , CSS files and images.. no HTML tag.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64717
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic