If you can't use PHP, here is how to do it with javascript (there are many other possibilities, this is just one of them).
From the document you found at http://www.dynamicdrive.com/style/la...p-frame-layout, just retain the following and put it in a document called menu.html:
menu.html:
Code:
<div id="framecontent">
<div class="innertube">
<h1>CSS Top Frame Layout</h1>
<h3>Sample text here</h3>
</div>
</div>
The styles given at http://www.dynamicdrive.com/style/la...p-frame-layout should be inserted into a css-file called (for instance) my_styles.css.
Content of my_styles.css:
Code:
body{
margin: 0;
padding: 0;
border: 0;
overflow: hidden;
height: 100%;
max-height: 100%;
}
#framecontent{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 130px; /*Height of frame div*/
overflow: hidden; /*Disable scrollbars. Set to "scroll" to enable*/
background-color: navy;
color: white;
}
#maincontent{
position: fixed;
top: 130px; /*Set top value to HeightOfFrameDiv*/
left: 0;
right: 0;
bottom: 0;
overflow: auto;
background: #fff;
}
.innertube{
margin: 15px; /*Margins for inner DIV inside each DIV (to provide padding)*/
}
* html body{ /*IE6 hack*/
padding: 130px 0 0 0; /*Set value to (HeightOfFrameDiv 0 0 0)*/
}
* html #maincontent{ /*IE6 hack*/
height: 100%;
width: 100%;
}
Now create a js-file called my_script.js and put the following in it:
my_script.js:
Code:
var div_node=document.createElement('div');
div_node.setAttribute("id", "menu_loader");
document.body.appendChild(div_node);
var iframe_pop=document.createElement('iframe');
iframe_pop.setAttribute("scrolling", "no");
iframe_pop.setAttribute("frameBorder", "no");
iframe_pop.setAttribute("name", "iframe");
iframe_pop.setAttribute("width", 0);
iframe_pop.setAttribute("height", 0);
iframe_pop.style.border="0px";
iframe_pop.style.position="absolute";
iframe_pop.style.left="-1000px";
iframe_pop.setAttribute("src", "menu.html");
document.body.appendChild(iframe_pop);
window.onload=include_menu;
function include_menu(){
document.getElementById('menu_loader').innerHTML = frames['iframe'].document.body.innerHTML
}
Finally, on each page in which you want to include the menu (menu.html), put the following:
Each page in which you want to include the menu (menu.html):
Code:
<head>
<link href="my_styles.css" rel="stylesheet">
</head>
<body>
<!-- Script must be put in the body -->
<script type="text/javascript" src="my_script.js"></script>
<div id="maincontent" style="padding:10px">
Your content
</div>
</body>
This will do the trick.
Edit:
If you want to use javascript functions in menu.html, don't put them in menu.html itself, but on each page in which you want to include menu.html!
===
Arie Molendijk.
Bookmarks