Question:
If I have two pages: pagina1.html
and pagina2.html
, which are very similar, is it possible to use a page layout.html
to determine common elements of each page? And so also avoid the repetition of tags
as happens in Asp.Net MVC projects, Ruby on Rails, etc…
Answer:
/////javascript function
function url(link){
document.getElementById("conteudo").setAttribute('src','paginas/'+link);
}
////links HTML
<div onclick="url('inicio.html')">Início</div>
<div onclick="url('sobre.html')">Sobre</div>
<div onclick="url('contato.html')">contato</div>
///// PLACE IFRAME BETWEEN THE HEADER AND THE FOOTER OF YOUR SITE WHERE THE CONTENT WILL APPEAR.
<iframe id="conteudo">
</iframe>
REMEMBERING THAT YOU WILL HAVE TO REMOVE THE IFRAME BORDER AND THE SCROLLBAR IF YOU PREFER BY CSS.