Log in

View Full Version : Menu external html css xhtml script



Wakel
03-11-2010, 07:02 AM
Hello to all,

I'm looking for, if it's possible a menu, but I'm needing it to have the url links on an external file, such as css,html,xhtml etc BUT NOT PHP etc.

Why! you may be asking yourself :confused:

Well, the reason is so I can update my menu, by updating one external file and not having to update all my html pages.

I know about an <iframe> with a externel html to be displayed within the <iframe> but I've had some trouble with iframes before with some browser's not displaying.

I've see some image scripts with externel css with image/alt/link code, so I'm hoping for a clickable text/link code within css and to link css in html to display the css clickable text/link.

If anyone would like to point me in the right direction or to give me the bad news of it's not possible.

Note: menu need to be vertical and search friendly

Thanks for looking

molendijk
03-11-2010, 09:11 PM
I don't understand what you want. Just a way to include a menu on every page of your site?
===
Arie Molendijk.

Wakel
03-12-2010, 01:39 AM
I don't understand what you want. Just a way to include a menu on every page of your site?
===
Arie Molendijk.

Thanks for your reply,

Within the css file something like this:

<script type="text/javascript">
menulink[0]='<a href="http://">Link 1</a>'
menulink[1]='<a href="http://">Link 2</a>'
menulink[2]='<a href="http://">Link 3</a>'
menulink[3]='<a href="http://">Link 4</a>'
menulink[4]='<a href="http://">Link 5</a>'
</script>

and then within the html/xhtml file a code like this:

<head>
<link rel="stylesheet" type="text/css" href="menu.css" />
</head>
<body>
<div id="menu" class="menu">
script goes here
<div>


PLEASE NOTE: the above code is just an example

This way, when I want to update the menu links, all I have to do is to edit one css file and dont have to edit every html/xhtml file
Many thanks

Wakel
03-12-2010, 05:43 AM
Hello again :D

I've been working on this script below, this may help explain what I'm needing better.
Below you'll see html file code and js file code, both of which makes up a drop down menu with links. Links are within the js file and not the html file.
I'm needing simular file, but for just a menu(not drop down) text, images or link.

html file:
*********************
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<TITLE></TITLE>
<META NAME="Generator" CONTENT="TextPad 4.6">
<META NAME="Author" CONTENT="?">
<META NAME="Keywords" CONTENT="?">
<META NAME="Description" CONTENT="?">
</HEAD>

<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#FF0000" VLINK="#800000" ALINK="#FF00FF" BACKGROUND="?">


<script src="./chgoto.js" language="JavaScript" type="text/javascript"></script>


</BODY>
</HTML>

*********************

js file:
*********************

function menu_goto( menuform )
{

var baseurl = 'http://freelaptopmanuals.com/' ;
selecteditem = menuform.url.selectedIndex ;
newurl = menuform.url.options[ selecteditem ].value ;
if (newurl.length != 0) {
location.href = baseurl + newurl ;
}
}
document.writeln( '<form action="chgoto" method="get">' );
document.writeln( '<select name="url" onchange="menu_goto(this.form)">' );
document.writeln( '<option value="default.aspx">Home</option>' );
document.writeln( '<option value="laptop_manuals.html">Laptop Manuals</option>' );
document.writeln( '<option value="info_guides.html">Info Guides</option>' );
document.writeln( '<option value="laptop_support_forum.html">Laptop Support Forum</option>' );
document.writeln( '<option value="free_laptop_service_user_manual_search.html">Search</option>' );
document.writeln( '<option value="advertise.html">Advertise</option>' );
document.writeln( '<option value="contact_us.html">Contact Us</option>' );
document.writeln( '</select>' );
document.writeln( '</form>' );

**********************************************************

molendijk
03-12-2010, 10:32 AM
js file for including menu.html. Call the js file: include_menu.js:
function include(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);
}
}
include('menu.html')
In menu.html: anything you want. Put some text in it to test.

In each page in which you want to include menu.html, something like:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<title></title>
</head>

<body>
<div>
This is text from your main page<br>
<script type="text/javascript" src="include_menu.js"></script>
</div>
</body>

</html>
===
Arie Molendijk.

Wakel
03-12-2010, 03:59 PM
Thank you molendijk, your a star :)

One question about your js file!

Is it Search engine friendly? Will search engine's find html file i.e.
include('menu.html') from within your js file?

Many thanks again for all your help

molendijk
03-12-2010, 05:23 PM
The included content is invisible to Google, I'm afraid.
===
Arie

Wakel
03-14-2010, 02:54 AM
The included content is invisible to Google, I'm afraid.
===
Arie

I've found this menu script http://dynamicdrive.com/dynamicindex1/slideinmenu4.htm and just to ask if this is more Gooogle friendly?
i.e. will the menu.html file be searchable?

molendijk
03-14-2010, 02:53 PM
I don't think so. Ajax-includes are not searchable (I think).
===
Arie.