File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes Showing HTML from another page 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 "Showing HTML from another page" Watch "Showing HTML from another page" New topic

Showing HTML from another page

Tarik Ansari
Ranch Hand

Joined: Dec 31, 2008
Posts: 50

Hi All,

I have a requirement.. I have three html pages Menu.html, Display1.html and Display2.html.

Menu.html has two links-> Display1 and Diplay2. Onclick of either Diplay1 or Disply2 link it has to open the appropriate html (Display1.html or Display2.html) within the Menu.html. (Embed another html in menu html)

Hint: Get innerhtml from external page.

Please help me.

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63851

In the click hander for the link, use Ajax to fetch the page to insert and stick it into the DOM.

This is a lot of rather advanced JavaScript code, and I get the impression you are not very familiar with JavaScript.

I'd recommend using a library like jQuery or Dojo to help you with the event handling, Ajax, and DOM manipulation. You'll still need to learn some JavaScript, but not as much all at once.

Also bear in the mind that the "sub-pages" should not be full HTML pages, they should be HTML fragments suitable for where you want to load them.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: Showing HTML from another page
It's not a secret anymore!