NameSilo

DHTML navigation menu

Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
SpaceshipSpaceship
Watch

shadowheart

New Member
Impact
0
I'm trying to make a simple text-based menu that expands similarly to how folders expand in windows explorer. I've tried 2 different ways to achieve this, and both works flawlessly in IE and Opera. However, in Firefox (and Mozilla too I would guess since they were both made by Mozilla), the submenus refuses to expand. I'm out of clues now and I'm desperate for some help. I need the script to work on as many different browsers as I can.

The script is as follows:

<!-- Hide script from older browsers
// Open the menu specified by 'currMenu'
function toggleMenu(currMenu)
{
var thisMenu;
var thisPic = eval("document.menu" + currMenu + "p");
var menuOffsets = new Array(88, 124, 52, 52); // => 12 * Rader + 4 <=> Rader * 10 + (Rader + 2) * 2
var openMenus = new Array(0, 0, 0, 0);
var menu2o;
var menu3o;
var menu4o;
var menu5o;

if(document.all)
{
thisMenu = eval("document.all.menu" + currMenu + "content.style");
menu2o = eval("document.all.menu2.style");
menu3o = eval("document.all.menu3.style");
menu4o = eval("document.all.menu4.style");
menu5o = eval("document.all.menu5.style");
}
else if(document.getElementById)
{
thisMenu = eval("document.getElementById('menu" + currMenu + "content')");
menu2o = eval("document.getElementById('menu2')");
menu3o = eval("document.getElementById('menu3')");
menu4o = eval("document.getElementById('menu4')");
menu5o = eval("document.getElementById('menu5')");
}
else
{
thisMenu = eval("document.menu" + currMenu + "content");
menu2o = eval("document.menu2");
menu3o = eval("document.menu3");
menu4o = eval("document.menu4");
menu5o = eval("document.menu5");
}

if(thisMenu.display == "block")
{
thisMenu.display = "none";
thisPic.src = "images/plus.gif";
openMenus[currMenu-1] = 0;
}
else
{
thisMenu.display = "block";
thisPic.src = "images/minus.gif";
openMenus[currMenu-1] = 1;
}

menu2o.top = 32 + menuOffsets[0]*openMenus[0];
menu3o.top = 44 + menuOffsets[0]*openMenus[0] + menuOffsets[1]*openMenus[1];
menu4o.top = 56 + menuOffsets[0]*openMenus[0] + menuOffsets[1]*openMenus[1] + menuOffsets[2]*openMenus[2];
menu5o.top = 68 + menuOffsets[0]*openMenus[0] + menuOffsets[1]*openMenus[1] + menuOffsets[2]*openMenus[2] + menuOffsets[3]*openMenus[3];
}
// Stop hiding script -->


In Firefox the images will change correctly, but the submenus will not appear (the .display = "block" part) and the last bit where the top properties of the menus are changed doesn't work either. The Firefox JavaScript Console finds no errors in the script :|
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Nevermind, I fixed it myself :)
 
0
Close
AIVikingsAIVikings

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back