PDA

View Full Version : Two types of menus!!



ACJavascript
Aug 24th, 2005, 11:15 PM
Hey all,

Okay heres my problem.

Depending on the browser and OS system the visitor is using I need to display a certain menu system. The browser information is easy but I am having a problem displaying 2 different menus.

Heres the below Code:





<script language="JavaScript">
//browser check code
<!--
var detect = navigator.userAgent.toLowerCase();
var OS,browser,version,total,thestring;

if (checkIt('konqueror'))
{
browser = "Konqueror";
OS = "Linux";
}
else if (checkIt('safari')) browser = "Safari"
else if (checkIt('omniweb')) browser = "OmniWeb"
else if (checkIt('opera')) browser = "Opera"
else if (checkIt('webtv')) browser = "WebTV";
else if (checkIt('icab')) browser = "iCab"
else if (checkIt('msie')) browser = "Internet Explorer"
else if (!checkIt('compatible'))
{
browser = "Netscape Navigator"
version = detect.charAt(8);
}
else browser = "An unknown browser";

if (!version) version = detect.charAt(place + thestring.length);

if (!OS)
{
if (checkIt('linux')) OS = "Linux";
else if (checkIt('x11')) OS = "Unix";
else if (checkIt('mac')) OS = "Mac"
else if (checkIt('win')) OS = "Windows"
else OS = "an unknown operating system";
}


function checkIt(string)
{
place = detect.indexOf(string) + 1;
thestring = string;
return place;
}

if(OS=="Mac" && version<="5"){
//MENU1
}else{
//MENU2
}


// -->
</script>


Now the first MENU is a simple text menu, easy. But the second menu is dynamic and doesn't want to display.

Here is the dynamic menues code:


<script language="javascript1.2">
addpath="";
fxsource="<fxsource src=fxdom.js></fxsource>"
</script>
<script language=javascript1.2 src=fxmenu.js></script>
<script language=javascript1.2 src=input.js></script>
<script language="javascript1.2" src="overlap.js"></script>


<table cellpadding=0 cellspacing=0 border=0>
<tr>
<td><script>fixMenu(MainMenu)</script></td>
</tr>
</table>


I oringaly used a document.write and just wrote out the code but the menu wouldn't work.

Any advice is greatly appreciated!! :)