Winston a écrit :
Hello,
I am not sure if I need Javascript for this:
You don't need it but you can use it if you add a normal link to a page
with this menu for those who haven't JavaScript.
In your pages :
1) in head, call to the JS file which will write the menu :
<script type="text/javascript" src="/js/menu.js"></script>
2) in body at place of your menu :
<noscript>
<p><a href="menu.htm">help navigation</a></p>
</noscript>
<script type="text/javascript">
menu();
</script>
3) rest to write the external file 'menu.js' :
function menu()
{
document.write(
'<div id="menu">' +
'<a href="p1.htm">page 1<\/a><br>' +
'<a href="p2.htm">page 2<\/a><br>' +
'<a href="p3.htm">page 3<\/a><br>' +
'<\/div>'
};
}
I want just one page for the menu code, but that it appears en every
subpages. So How can I put a html file inside a DIV?
You can also try tag 'object' :
<object data="menu.html" type="text/html" width="300" height="200">
alt : <a href="menu.html">help (menu)</a>
</object>
What about to try SSI ? :
1) extensions of files needing SSI are usually : *.shtml
2) make your menu in a separate file ie : menu.txt
(copy-paste only its div and content)
3) in your pages, in place of div menu :
<!--#include virtual="menu.txt -->
4) Save your pages with menu in *.shtml
5) verify all your links and delete from their urls the extensions
of files (if you sure to have only one file with this name in
same folder). The server doesn't need to know these extensions.
This include works only on a server.
Server must have SSI actived.
http://httpd.apache.org/docs/2.0/howto/ssi.html
tuto in french :
http://www.scarabee.com/TRANCHES/SSI/publicvise.shtml
--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date