Dynadot .com transfer sale, only $10.12 with coupon code DYNA12, available while supplies last, ends October 31, 2026.

DHTML navigation menu

Namecheap AuctionsNamecheap Auctions
Namecheap AuctionsNamecheap Auctions
Spacemail by SpaceshipSpacemail by Spaceship
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
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Nevermind, I fixed it myself :)
 
0
•••
CatchedCatched

We're social

Escrow.com
Spaceship
Escrowly
CryptoExchange.com
Domain Recover

NamePros updates

Parking: find your domains by pasting a list
You can now paste a list of domain names into the search box at the top of the Parking menu. Put one name on each line. Your domain list...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back