0

I have a page that shares the same footer / header layout and design.

I am looking for sample javascript code that allows clicking on menu to reload center panel only. I am not doing it in JSP. I hope to get some sample javascript code.

Can I put the center panel in an iFrame or another type of widget?

What is the most efficient way to do this?

Thanks a lot.

dojomedojo
  • 445
  • 1
  • 4
  • 17

1 Answers1

1

From this question

document.getElementById('iframeid').src = document.getElementById('iframeid').src

However, this if your header and footer are in frames, or if your body is in a frame, just to make them resuable, this is a Bad Idea! Your server should be generating a SINGLE PAGE by using a layout page for the header and footer, and rendering the body.

Community
  • 1
  • 1
Kyeotic
  • 19,697
  • 10
  • 71
  • 128
  • Thanks for the information. Could you be more specific why I can't make header / footer / body into three different iframes. I want to keep header / footer the same most of the time, and then just reload the body (the 3rd iframe in this case) when I click on different menus. Thanks again. – dojomedojo Jun 06 '12 at 14:39
  • @JavaDoe There are a lot of reasons why iframes are discouraged, loss of bookmarking ability is one, and they generally complicate navigation. This is not to say you can't do it, or that iframes are always bad; but in your use case there is a better solution. A master/layout file gives you the same ability to reuse the top and bottom section of a site, and is generally encouraged (most modern web servers frameworks support this ability, including MVC3, ruby on rails, django, and Express(Node)). If you don't know what web server you are using, I would encourage you to find out. – Kyeotic Jun 06 '12 at 15:29
  • hello Instead of using the iframe, I want to use the following to update the center pane of the page. I would like to get some help on the following. If have another HTML page I want to load to the center pane, what would be the right syntax for it? document.getElementById( 'centerPane' ).innerHTML.??? = 'SampleHTML.htm' ; What attribute do I need to get after innerHTML? Thanks again. – dojomedojo Jun 06 '12 at 19:17
  • Please ask this in another question. – Kyeotic Jun 06 '12 at 19:32