1.
Follow the steps given at http://www.dynamicdrive.com/dynamici...ddmegamenu.htm for constructing a standalone menu. Let's call the file: menu.html.
2.
In menu.html, replace:
Code:
<script>
ddmegamenu.docinit({
menuid:'solidmenu',
dur:200 //<--no comma after last setting
})
ddmegamenu.docinit({
menuid:'megaanchorlink',
dur:500,
easing:'easeInOutCirc' //<--no comma after last setting
})
</script>
with:
Code:
<script type="text/javascript" src="init.js"></script>
and create a file init.js containing the following lines:
Code:
ddmegamenu.docinit({
menuid:'solidmenu',
dur:200 //<--no comma after last setting
})
ddmegamenu.docinit({
menuid:'megaanchorlink',
dur:500,
easing:'easeInOutCirc' //<--no comma after last setting
})
3.
Also create a file include_menu.js and put the following lines in it:
Code:
function HttpRequest(url){
var pageRequest = false //variable to hold ajax object
/*@cc_on
@if (@_jscript_version >= 5)
try {
pageRequest = new ActiveXObject("Msxml2.XMLHTTP")
}
catch (e){
try {
pageRequest = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e2){
pageRequest = false
}
}
@end
@*/ if (!pageRequest && typeof XMLHttpRequest != 'undefined')
pageRequest = new XMLHttpRequest()
if (pageRequest){ //if pageRequest is not false
pageRequest.open('GET', url, false) //get page synchronously
pageRequest.send(null)
document.write(pageRequest.responseText)
}
}
4.
Now in each file into which you want to insert the menu, put:
Code:
head:
<script type="text/javascript" src="include_menu.js"></script>
body (somewhere):
<script type="text/javascript">HttpRequest('menu.html')</script>
The files into which you insert the menu should have a valid doctype, for instance:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
Note that the arrows in the menu don't show if you are using IE. That's also the case at http://www.dynamicdrive.com/dynamici...ddmegamenu.htm
===
Arie Molendijk.
Bookmarks