NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page DHTML navigation menu

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search
5 members in live chat ~  


Closed Thread
 
LinkBack Thread Tools
Old 08-17-2004, 08:29 AM THREAD STARTER               #1 (permalink)
New Member
Join Date: Aug 2004
Location: Sweden
Posts: 2
shadowheart is an unknown quantity at this point
 



DHTML navigation menu


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";
????: NamePros.com http://www.namepros.com/programming/43724-dhtml-navigation-menu.html
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
__________________
"How do we prove that we exist? Maybe we don't exist..." - Vivi, FFIX
shadowheart is offline  
Old 08-17-2004, 04:13 PM THREAD STARTER               #2 (permalink)
New Member
Join Date: Aug 2004
Location: Sweden
Posts: 2
shadowheart is an unknown quantity at this point
 



Nevermind, I fixed it myself
__________________
"How do we prove that we exist? Maybe we don't exist..." - Vivi, FFIX
shadowheart is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


 
All times are GMT -7. The time now is 02:26 PM.

Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger