HI,
I have a collapse/expand side menu that has been operating fine for a couple of years. The company has just started rolling out OS X on the macs - the menu system does not work correctly on this new system. Instead of collapsing/expanding the menu just reproduces itself within the main frame. The links within the menu work fine, but the menu that is reproduced within the main frame does not expand/collapse.
The code is below - can anyone see where I have gone wrong ?
<SCRIPT LANGUAGE="JavaScript">
function BrowserVerChecker() {
var BrowserName = navigator.appName;
if (BrowserName=="Netscape") this.BrowserName = "NS";
else
if (BrowserName=="Microsoft Internet Explorer") this.BrowserName = "IE";
else
this.BrowserName = BrowserName;
this.BrowserVersion = navigator.appVersion;
this.Version = parseInt(this.BrowserVersion);
this.NS4 = (this.BrowserName=="NS" && this.Version==4);
this.NS5 = (this.BrowserName=="NS" && this.Version==5);
this.NS6 = (this.BrowserName=="NS" && this.Version==6);
this.IE = (this.BrowserName=="IE" && this.Version>=5);
}
Check = new BrowserVerChecker();
var nom = 6; // Number of menus
var ttls = new Array(); // An array for the title objects
var subs = new Array(); // An array for the submenu objects
var lastn;
var lastmove;
if (document.layers){
visible = 'show';
hidden = 'hide';
}else{
visible = 'visible';
hidden = 'hidden';
}
for (var i = 1; i <= nom; i++){
ttls = ('title' + i);
subs = ('submenu' +i);
}
lastn = (nom + 1);
lastmove = 0;
function lasttoggle(n,move){
if (n <= nom){
menu = ('submenu' + n);
if (Check.NS4){
submenu = document.layers[menu];
}else if (Check.IE){
submenu = document.all(menu).style;
}else{
submenu = document.getElementById(menu);
submenu = submenu.style
}
if (submenu.visibility == visible){
submenu.visibility = hidden;
for (var i = (n+1); i <= nom; i++){
if (Check.NS4){
document.layers[ttls].top -= move;
document.layers[subs].top -= move;
}else if (Check.IE){
document.all(ttls).style.pixelTop -= move;
document.all(subs).style.pixelTop -= move;
}else{
document.all(ttls).style.pixelTop -= move;
document.all(subs).style.pixelTop -= move;}
}
}
}
}
function toggle(n,move){
menu = ('submenu' + n);
if (Check.NS4){
submenu = document.layers[menu];
}else if (Check.IE){
submenu = document.all(menu).style;
}else{
submenu = document.getElementById(menu);
submenu = submenu.style
}
if (submenu.visibility == visible){
submenu.visibility = hidden;
for (var i = (n+1); i <= nom; i++){
if (Check.NS4){
document.layers[ttls].top -= move;
document.layers[subs].top -= move;
}
else if (Check.IE){
document.all(ttls).style.pixelTop -= move;
document.all(subs).style.pixelTop -= move;
}else{
document.all(ttls).style.pixelTop -= move;
document.all(subs).style.pixelTop -= move;}
}
}
else{
submenu.visibility = visible;
if (lastn != n){
lasttoggle(lastn,lastmove);
}
for (var i = (n+1); i <= nom; i++){
if (Check.NS4){
document.layers[ttls].top += move;
document.layers[subs].top += move;
}else if (Check.IE){
document.all(ttls).style.pixelTop += move;
document.all(subs).style.pixelTop += move;
}else{
document.all(ttls).style.pixelTop += move;
document.all(subs).style.pixelTop += move;}
}
}
lastn = n;
lastmove = move;
ChangeImage();
}
function ChangeImage(){
for(var i =1; i <= nom; i++){
var menu = 'submenu' + i;
var submenu;
var image;
var title = 'title' + i;
var picNo = 'pic' + i;
if(Check.NS4){
submenu = document.layers[menu];
image = document.layers[title].document[picNo];
}else if (Check.IE){
submenu = document.all(menu).style;
image = document.all(picNo);
}else{
submenu = document.all(menu).style;
image = document.all(picNo);
}
switch(i){
case 1:
Pic2 = 'Images/buttons/LinksTime2.gif';
Pic1 = 'Images/buttons/LinksTime.gif';
break;
case 2:
Pic2 = 'Images/buttons/LinksFortune2.gif';
Pic1 = 'Images/buttons/LinksFortune.gif';
break;
case 3:
Pic2 = 'Images/buttons/LinksPeople2.gif';
Pic1 = 'Images/buttons/LinksPeople.gif';
break;
case 4:
Pic2 = 'Images/buttons/LinksWallpaper2.gif';
Pic1 = 'Images/buttons/LinksWallpaper.gif';
break;
case 5:
Pic2 = 'Images/buttons/LinksIntranetLinks2.gif';
Pic1 = 'Images/buttons/LinksIntranetLinks.gif';
break;
case 6:
Pic2 = 'Images/buttons/LinksWebLinks2.gif';
Pic1 = 'Images/buttons/LinksWebLinks.gif';
break;
}
if (submenu.visibility == visible){
image.src = Pic1
}else{
image.src = Pic2
}
}
}
function TimeLinks(form)
{
var strURL = form.selTimeLinks.options[form.selTimeLinks.selectedIndex].value;
window.open(strURL, "Main");
}
function TWLinks(form)
{
var strURL = form.selTWLinks.options[form.selTWLinks.selectedIndex].value;
window.open(strURL, "Main")
}
// End -->
</SCRIPT>
<BASE TARGET="Main">
<META content="Microsoft FrontPage 5.0" name=GENERATOR>
</HEAD>
<BODY text=#000000 vLink=#c0c0c0 link=#c0c0c0 bgColor=#ffffff leftMargin=0
topMargin=0><SPAN class=Date>
<SCRIPT language=JavaScript>
<!-- Begin
var months=new Array(12);
months[0]="January";
months[1]="February";
months[2]="March";
months[3]="April";
months[4]="May";
months[5]="June";
months[6]="July";
months[7]="August";
months[8]="September";
months[9]="October";
months[10]="November";
months[11]="December";
var time=new Date();
var strMonth=months[time.getMonth()];
var strDay=time.getDate();
var strYear=time.getYear();
if (strYear < 2000)
strYear = strYear + 1900;
var strToday = strMonth + " " + strDay + ", " + strYear
//document.write (strToday);
// End -->
I have a collapse/expand side menu that has been operating fine for a couple of years. The company has just started rolling out OS X on the macs - the menu system does not work correctly on this new system. Instead of collapsing/expanding the menu just reproduces itself within the main frame. The links within the menu work fine, but the menu that is reproduced within the main frame does not expand/collapse.
The code is below - can anyone see where I have gone wrong ?
<SCRIPT LANGUAGE="JavaScript">
function BrowserVerChecker() {
var BrowserName = navigator.appName;
if (BrowserName=="Netscape") this.BrowserName = "NS";
else
if (BrowserName=="Microsoft Internet Explorer") this.BrowserName = "IE";
else
this.BrowserName = BrowserName;
this.BrowserVersion = navigator.appVersion;
this.Version = parseInt(this.BrowserVersion);
this.NS4 = (this.BrowserName=="NS" && this.Version==4);
this.NS5 = (this.BrowserName=="NS" && this.Version==5);
this.NS6 = (this.BrowserName=="NS" && this.Version==6);
this.IE = (this.BrowserName=="IE" && this.Version>=5);
}
Check = new BrowserVerChecker();
var nom = 6; // Number of menus
var ttls = new Array(); // An array for the title objects
var subs = new Array(); // An array for the submenu objects
var lastn;
var lastmove;
if (document.layers){
visible = 'show';
hidden = 'hide';
}else{
visible = 'visible';
hidden = 'hidden';
}
for (var i = 1; i <= nom; i++){
ttls = ('title' + i);
subs = ('submenu' +i);
}
lastn = (nom + 1);
lastmove = 0;
function lasttoggle(n,move){
if (n <= nom){
menu = ('submenu' + n);
if (Check.NS4){
submenu = document.layers[menu];
}else if (Check.IE){
submenu = document.all(menu).style;
}else{
submenu = document.getElementById(menu);
submenu = submenu.style
}
if (submenu.visibility == visible){
submenu.visibility = hidden;
for (var i = (n+1); i <= nom; i++){
if (Check.NS4){
document.layers[ttls].top -= move;
document.layers[subs].top -= move;
}else if (Check.IE){
document.all(ttls).style.pixelTop -= move;
document.all(subs).style.pixelTop -= move;
}else{
document.all(ttls).style.pixelTop -= move;
document.all(subs).style.pixelTop -= move;}
}
}
}
}
function toggle(n,move){
menu = ('submenu' + n);
if (Check.NS4){
submenu = document.layers[menu];
}else if (Check.IE){
submenu = document.all(menu).style;
}else{
submenu = document.getElementById(menu);
submenu = submenu.style
}
if (submenu.visibility == visible){
submenu.visibility = hidden;
for (var i = (n+1); i <= nom; i++){
if (Check.NS4){
document.layers[ttls].top -= move;
document.layers[subs].top -= move;
}
else if (Check.IE){
document.all(ttls).style.pixelTop -= move;
document.all(subs).style.pixelTop -= move;
}else{
document.all(ttls).style.pixelTop -= move;
document.all(subs).style.pixelTop -= move;}
}
}
else{
submenu.visibility = visible;
if (lastn != n){
lasttoggle(lastn,lastmove);
}
for (var i = (n+1); i <= nom; i++){
if (Check.NS4){
document.layers[ttls].top += move;
document.layers[subs].top += move;
}else if (Check.IE){
document.all(ttls).style.pixelTop += move;
document.all(subs).style.pixelTop += move;
}else{
document.all(ttls).style.pixelTop += move;
document.all(subs).style.pixelTop += move;}
}
}
lastn = n;
lastmove = move;
ChangeImage();
}
function ChangeImage(){
for(var i =1; i <= nom; i++){
var menu = 'submenu' + i;
var submenu;
var image;
var title = 'title' + i;
var picNo = 'pic' + i;
if(Check.NS4){
submenu = document.layers[menu];
image = document.layers[title].document[picNo];
}else if (Check.IE){
submenu = document.all(menu).style;
image = document.all(picNo);
}else{
submenu = document.all(menu).style;
image = document.all(picNo);
}
switch(i){
case 1:
Pic2 = 'Images/buttons/LinksTime2.gif';
Pic1 = 'Images/buttons/LinksTime.gif';
break;
case 2:
Pic2 = 'Images/buttons/LinksFortune2.gif';
Pic1 = 'Images/buttons/LinksFortune.gif';
break;
case 3:
Pic2 = 'Images/buttons/LinksPeople2.gif';
Pic1 = 'Images/buttons/LinksPeople.gif';
break;
case 4:
Pic2 = 'Images/buttons/LinksWallpaper2.gif';
Pic1 = 'Images/buttons/LinksWallpaper.gif';
break;
case 5:
Pic2 = 'Images/buttons/LinksIntranetLinks2.gif';
Pic1 = 'Images/buttons/LinksIntranetLinks.gif';
break;
case 6:
Pic2 = 'Images/buttons/LinksWebLinks2.gif';
Pic1 = 'Images/buttons/LinksWebLinks.gif';
break;
}
if (submenu.visibility == visible){
image.src = Pic1
}else{
image.src = Pic2
}
}
}
function TimeLinks(form)
{
var strURL = form.selTimeLinks.options[form.selTimeLinks.selectedIndex].value;
window.open(strURL, "Main");
}
function TWLinks(form)
{
var strURL = form.selTWLinks.options[form.selTWLinks.selectedIndex].value;
window.open(strURL, "Main")
}
// End -->
</SCRIPT>
<BASE TARGET="Main">
<META content="Microsoft FrontPage 5.0" name=GENERATOR>
</HEAD>
<BODY text=#000000 vLink=#c0c0c0 link=#c0c0c0 bgColor=#ffffff leftMargin=0
topMargin=0><SPAN class=Date>
<SCRIPT language=JavaScript>
<!-- Begin
var months=new Array(12);
months[0]="January";
months[1]="February";
months[2]="March";
months[3]="April";
months[4]="May";
months[5]="June";
months[6]="July";
months[7]="August";
months[8]="September";
months[9]="October";
months[10]="November";
months[11]="December";
var time=new Date();
var strMonth=months[time.getMonth()];
var strDay=time.getDate();
var strYear=time.getYear();
if (strYear < 2000)
strYear = strYear + 1900;
var strToday = strMonth + " " + strDay + ", " + strYear
//document.write (strToday);
// End -->