Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 21
  1. #1
    New Coder
    Join Date
    Mar 2008
    Posts
    21
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Firefox menu problem

    This has been bugging me forever and I'm at the end of my rope! My javascript menu works fine in IE but not at all in firefox. I have used multiple debugging utilities like firebug, and they all come up with the same error "missing ( before formal parameters" for the function below, the error line is in bold:

    <code>

    //Docuemnt Mouse Over event of the Menu Control
    function document.onmouseover()
    {
    var eSrc = window.event.srcElement;

    if(eSrc!=null)
    {
    if (eSrc.className == "clsMenuBarItem")
    {
    eSrc.style.color = "#00196A";
    var eMenu = document.all[eSrc.id.replace("tdMenuBarItem","divMenu")];
    if (eOpenMenu && eOpenMenu != eMenu)
    {
    CloseMenu(eOpenMenu);
    }
    if (eMenu)
    {
    OpenMenu(eSrc,eMenu);
    }
    }
    else if (eOpenMenu && !eOpenMenu.contains(eSrc) && !divMenuBar.contains(eSrc))
    {
    CloseMenu(eOpenMenu);
    }

    if (eSrc.className == "clsMenuGroupItem")
    {
    var tdArrow = document.all[eSrc.id.replace("divMenuItem","tdArrow")];
    tdArrow.style.backgroundColor = "#d3d8e7";
    eSrc.style.backgroundColor = "#d3d8e7";

    var eMenu = document.all[eSrc.id.replace("divMenuItem","divSubMenu")];
    if (eOpenSubMenu && eOpenSubMenu != eMenu)
    {
    CloseSubMenu(eOpenSubMenu);
    }
    if (eMenu)
    {
    OpenSubMenu(eSrc,eMenu);
    }
    }
    else if (eOpenSubMenu && !eOpenSubMenu.contains(eSrc))// && !divMenuBar.contains(eSrc))
    {
    CloseSubMenu(eOpenSubMenu);
    }

    }
    }
    </code>

    I have no idea how to fix this, I didn't write the original code so I don't have a very good understanding of it. Any help would be greatly appreciated.

    Thanks in advance
    -Will

  • #2
    Regular Coder
    Join Date
    Mar 2006
    Posts
    726
    Thanks
    35
    Thanked 132 Times in 123 Posts
    function document.onmouseover() will only work in IE, to start with. It will thow an error in other browsers.

    There is no global event or or document.all or event.srcELement or contains method in firefox.
    You are also referencing elements an IE only way, by globally calling their name.
    None of this will work in firefox. You can't 'fix' it- you can only write a separate script for non-ie browsers, or start over.

    The best thing to do may be just to keep it from running in other browsers.
    Trouble is, just the declaration line will cause an error in most browsers-

    You could change that line from function document.onmouseover(){ to document.onmouseover= function(){

    And wrap all of the code between if(document.all && window.event){
    // your code here, and
    }
    Last edited by mrhoo; 04-19-2008 at 02:00 AM.

  • #3
    New Coder
    Join Date
    Mar 2008
    Posts
    21
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Thank you so much for the reply... Wow I had no idea it was that much of a problem, I guess i'll have to rewrite it then. I know this is a lot to ask, but if anyone has any suggestions on how to write this in a way that would function in any browser I would really appreciate it. This js file is accessed by a large web app so I can't just change the menu, I really need a js file that will function in the same way, but work in other browsers.
    Thanks again
    -Will

  • #4
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,849
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Have a try with the CSS based suckerfish menu, www.htmldog.com/articles/suckerfish/dropdowns/
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #5
    New Coder
    Join Date
    Mar 2008
    Posts
    21
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Thanks for the reply. Unfortunately this menu.js is accessed by a large web app and it would take a VERY long time to change every menu, so out of laziness and pressure from my boss, I would really like to come up with a new menu.js file that would function in all browsers. Is there a way to simply open up all the menus when the page loads so they can at least access the links?
    Thanks again
    -Will

  • #6
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,849
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    t would take a VERY long time to change every menu, so out of laziness and pressure from my boss,
    Don't you have any serverside support?
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #7
    Regular Coder mjlorbet's Avatar
    Join Date
    Jan 2008
    Location
    Milwaukee, WI
    Posts
    724
    Thanks
    8
    Thanked 96 Times in 95 Posts
    Code:
    //Docuemnt Mouse Over event of the Menu Control
    document.body.onmouseover = function(e)
    {
    var elem = e?e:event;
    var eSrc = elem.target?elem.target:elem.srcElement;
    if(eSrc!=null)
    {
    if (eSrc.className == "clsMenuBarItem")
    {
    eSrc.style.color = "#00196A"; 
    var eMenu = document.getElementById(eSrc.id.replace("tdMenuBarItem","divMenu"));
    if (eOpenMenu && eOpenMenu != eMenu) 
    {
    CloseMenu(eOpenMenu);
    }
    if (eMenu) 
    {
    OpenMenu(eSrc,eMenu);
    }
    }
    else if (eOpenMenu && !eOpenMenu.contains(eSrc) && !divMenuBar.contains(eSrc)) 
    {
    CloseMenu(eOpenMenu);
    }
    if (eSrc.className == "clsMenuGroupItem")
    {
    var tdArrow = document.getElementById(eSrc.id.replace("divMenuItem","tdArrow"));
    tdArrow.style.backgroundColor = "#d3d8e7";
    eSrc.style.backgroundColor = "#d3d8e7";
    var eMenu = document.getElementById(eSrc.id.replace("divMenuItem","divSubMenu"));
    if (eOpenSubMenu && eOpenSubMenu != eMenu) 
    {
    CloseSubMenu(eOpenSubMenu);
    }
    if (eMenu) 
    {
    OpenSubMenu(eSrc,eMenu);
    }
    }
    else if (eOpenSubMenu && !eOpenSubMenu.contains(eSrc))// && !divMenuBar.contains(eSrc)) 
    {
    CloseSubMenu(eOpenSubMenu);
    }
    }
    }
    fixed the event model and dropped the document.all business in exchange for document.getElementById which would be the more current syntax. i'm not sure where you've defined some of these things though, like eOpenSubMenu and so forth, so just make sure that the code that defines them also uses the methods contained herein
    -Mike
    "Want me to precludify him, like some kind of dispatcherator?... Can do!" -Bender

  • Users who have thanked mjlorbet for this post:

    bigbird8891 (04-23-2008)

  • #8
    New Coder
    Join Date
    Mar 2008
    Posts
    21
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Wow! Thank you so much Mike!! You have no idea how much I appreciate that! Only in this line of work will a complete stranger help someone out just to be a good person, it makes me feel all warm and fuzzy inside!

    On a separate note I still am having some minor issues, for one the menu doesn't close when I move my mouse out of it, I haven't looked into this much so it may just be an oversight, and I receive an error every time i mouse over a menu: "eOpenMenu is not a function" in reference to this line:
    Code:
    else if (eOpenSubMenu && !eOpenSubMenu.contains(eSrc))// && !divMenuBar.contains(eSrc))
    Here is the menu.js code in its entirety for reference:


    Code:
    //Variable to store the Opened Menu Object
    	var eOpenMenu = null;
    	var eOpenSubMenu = null;
    
    
    //Open Menu Function Controls the Menu Position
    	function OpenMenu(eSrc,eMenu)
    	{
    	
    		eMenu.style.left = eSrc.offsetLeft + divMenuBar.offsetLeft;
    		if(divMenuBar.offsetParent.offsetParent!=null)
    		{
    			eMenu.style.top = divMenuBar.offsetHeight + divMenuBar.offsetParent.offsetParent.offsetTop;
    		}
    		else
    		{
    			eMenu.style.top = divMenuBar.offsetHeight + divMenuBar.offsetTop;
    		}
    		eMenu.style.visibility = "visible";
    		eOpenMenu = eMenu;
    		HideMenuCombos();
    	}
    
    
    	function HideMenuCombos()
    	{	
    		if (eOpenMenu !=null)
    		{
    			var selColl = document.all.tags("SELECT");
    			var obj
    			//Rerives collection for all the Select tags in the document
    			if (selColl!=null)
    			{ 
    				for (i=0; i<selColl.length; i++) 
    				{	//selColl[i].style.visibility = "hidden";
    					//Hides the combos (Select tag) 
    					obj = selColl[i]
    					if (! obj || ! obj.offsetParent)
    					continue;
    
    					// Find the element's offsetTop and offsetLeft relative to the BODY tag.
    					objLeft   = obj.offsetLeft;
    					objTop    = obj.offsetTop;
    					objParent = obj.offsetParent;
    					while (objParent.tagName.toUpperCase() != "BODY")
    					{
    						objLeft  += objParent.offsetLeft;
    						objTop   += objParent.offsetTop;
    						objParent = objParent.offsetParent;
    					}
    					// Adjust the element's offsetTop relative to the dropdown menu
    					menuBottomRight = eOpenMenu.offsetLeft+ eOpenMenu.offsetWidth;
    					menuBottomLeft = eOpenMenu.offsetLeft;
    					menuBottom =  eOpenMenu.offsetTop + eOpenMenu.offsetHeight;
    					comboRight =  objLeft+obj.offsetWidth
    					
    					if ( menuBottom > objTop && menuBottomRight > objLeft && comboRight > menuBottomLeft )
    						 obj.style.visibility = "hidden";
    				}
    			}
    		}
    	}
    
    //Closes the Menu by hiding the Div
    	function CloseMenu(eMenu)
    	{
    		eMenu.style.visibility = "hidden";
    		eOpenMenu = null;
    		var selColl = document.all.tags("SELECT");
    		//Rerives collection for all the Select tags in the document
    			if (selColl!=null)
    			{
    				for (i=0; i<selColl.length; i++) 
    					selColl[i].style.visibility = "visible";
    			}
    	}
    	
    
    //Open Menu Function Controls the Menu Position
    	function OpenSubMenu(eSrc,eMenu)
    	{
    		var left = eSrc.offsetParent.offsetLeft;
    		var screenwidth = screen.width - 200;
    		
    		if (left < screenwidth)
    		{
    			eMenu.style.left = 115; 
    		}
    		else
    		{
    			eMenu.style.left = -125;
    		}
    		
    		// + divMenuBar.offsetLeft-8;
    		eMenu.style.top = eSrc.offsetTop;  //offsetHeight + divMenuBar.offsetTop; //+35;
    		eMenu.style.visibility = "visible";
    		eOpenSubMenu = eMenu;
    		
    		
    		var selColl = document.all.tags("SELECT");
    		var obj
    		//Rerives collection for all the Select tags in the document
    			if (selColl!=null)
    			{ 
    				for (i=0; i<selColl.length; i++) 
    				{	//selColl[i].style.visibility = "hidden";
    					//Hides the combos (Select tag) 
    					obj = selColl[i]
    					if (! obj || ! obj.offsetParent)
    					continue;
    
    					// Find the element's offsetTop and offsetLeft relative to the BODY tag.
    					objLeft   = obj.offsetLeft;
    					objTop    = obj.offsetTop;
    					objParent = obj.offsetParent;
    					while (objParent.tagName.toUpperCase() != "BODY")
    					{
    						objLeft  += objParent.offsetLeft;
    						objTop   += objParent.offsetTop;
    						objParent = objParent.offsetParent;
    					}
    					// Adjust the element's offsetTop relative to the dropdown menu
    					menuTop = divMenuBar.offsetHeight + divMenuBar.offsetParent.offsetParent.offsetTop+56 + eOpenSubMenu.offsetTop;
    					menuLeft = eOpenSubMenu.offsetParent.offsetLeft + eOpenSubMenu.offsetLeft;
    					menuRight = menuLeft+ eOpenSubMenu.offsetWidth;
    					menuBottom =  menuTop + eOpenSubMenu.offsetHeight;
    					comboRight =  objLeft+obj.offsetWidth;
    					
    					if ( menuBottom > objTop && menuRight > objLeft && comboRight > menuLeft && menuTop < objTop+obj.offsetHeight)
    						obj.style.visibility = "hidden";	
    					
    				}
    			}
    	}
    
    //Closes the Menu by hiding the Div
    	function CloseSubMenu(eMenu)
    	{
    		eMenu.style.visibility = "hidden";
    		eOpenSubMenu = null;
    				var selColl = document.all.tags("SELECT");
    		//Rerives collection for all the Select tags in the document
    			if (selColl!=null)
    			{
    				for (i=0; i<selColl.length; i++) 
    					selColl[i].style.visibility = "visible";
    			}
    				HideMenuCombos()
    	}
    
    //Docuemnt Mouse Over event of the Menu Control
    document.body.onmouseover = function(e)
    {
    var elem = e?e:event;
    var eSrc = elem.target?elem.target:elem.srcElement;
    if(eSrc!=null)
    {
    if (eSrc.className == "clsMenuBarItem")
    {
    eSrc.style.color = "#00196A"; 
    var eMenu = document.getElementById(eSrc.id.replace("tdMenuBarItem","divMenu"));
    if (eOpenMenu && eOpenMenu != eMenu) 
    {
    CloseMenu(eOpenMenu);
    }
    if (eMenu) 
    {
    OpenMenu(eSrc,eMenu);
    }
    }
    else if (eOpenMenu && !OpenMenu.contains(eSrc) && !divMenuBar.contains(eSrc)) 
    {
    CloseMenu(eOpenMenu);
    }
    if (eSrc.className == "clsMenuGroupItem")
    {
    var tdArrow = document.getElementById(eSrc.id.replace("divMenuItem","tdArrow"));
    tdArrow.style.backgroundColor = "#d3d8e7";
    eSrc.style.backgroundColor = "#d3d8e7";
    var eMenu = document.getElementById(eSrc.id.replace("divMenuItem","divSubMenu"));
    if (eOpenSubMenu && eOpenSubMenu != eMenu) 
    {
    CloseSubMenu(eOpenSubMenu);
    }
    if (eMenu) 
    {
    OpenSubMenu(eSrc,eMenu);
    }
    }
    else if (eOpenSubMenu && !eOpenSubMenu.contains(eSrc))// && !divMenuBar.contains(eSrc)) 
    {
    CloseSubMenu(eOpenSubMenu);
    }
    }
    }
    
    //Docuemnt Mouse Out event of the Menu Control	
    	document.body.onmouseout = function(e)
    	{
    		var elem = e?e:event;
    		var eSrc = elem.target?elem.target:elem.srcElement;
    		if(eSrc!=null)
    		{
    			if (eSrc.className == "clsMenuBarItem")
    			{
    				eSrc.style.color = ""; 
    			}
    			if (eSrc.className == "clsMenuGroupItem")
    			{
    				eSrc.style.color = "";
    				eSrc.style.backgroundColor = "#ffffff";
    				var tdArrow =	document.getElementById[eSrc.id.replace("divMenuItem","tdArrow")];
    				tdArrow.style.backgroundColor = "#ffffff";
    			}
    		}
    	}
    //Function sets the BG Color of the menu items
    	function setbgcolor(objSrc, blnIsSubMenu)
    	{	
    //		objSrc.style.background="cornflowerblue";
    		objSrc.className="clsMenuItemMouseOver";
    		
    	}
    //Function removes the BG Color of the menu items
    	function removebgcolor(objSrc, blnIsSubMenu)
    	{		
    		objSrc.style.background="#E7E3E7";//"ffffff";
    		
    		
    	}
    Thanks again so much.

    -Will

  • #9
    Regular Coder mjlorbet's Avatar
    Join Date
    Jan 2008
    Location
    Milwaukee, WI
    Posts
    724
    Thanks
    8
    Thanked 96 Times in 95 Posts
    Code:
    //Variable to store the Opened Menu Object
     var eOpenMenu = null;
     var eOpenSubMenu = null;
    
    //Open Menu Function Controls the Menu Position
     function OpenMenu(eSrc,eMenu)
     {
     
      eMenu.style.left = eSrc.offsetLeft + divMenuBar.offsetLeft;
      if(divMenuBar.offsetParent.offsetParent!=null)
      {
       eMenu.style.top = divMenuBar.offsetHeight + divMenuBar.parentElement.parentElement.offsetTop;
      }
      else
      {
       eMenu.style.top = divMenuBar.offsetHeight + divMenuBar.offsetTop;
      }
      eMenu.style.display = "block";
      eOpenMenu = eMenu;
      HideMenuCombos();
     }
    
     function HideMenuCombos()
     { 
      if (eOpenMenu !=null)
      {
       var selColl = document.all.tags("SELECT");
       var obj
       //Rerives collection for all the Select tags in the document
       if (selColl!=null)
       { 
        for (i=0; i<selColl.length; i++) 
        { //selColl[i].style.dislay = "none";
         //Hides the combos (Select tag) 
         obj = selColl[i]
         if (! obj || ! obj.parentElement)
         continue;
         // Find the element's offsetTop and offsetLeft relative to the BODY tag.
         objLeft   = obj.offsetLeft;
         objTop    = obj.offsetTop;
         objParent = obj.parentElement;
         while (objParent.tagName.toUpperCase() != "BODY")
         {
          objLeft  += objParent.offsetLeft;
          objTop   += objParent.offsetTop;
          objParent = objParent.parentElement;
         }
         // Adjust the element's offsetTop relative to the dropdown menu
         menuBottomRight = eOpenMenu.offsetLeft+ eOpenMenu.offsetWidth;
         menuBottomLeft = eOpenMenu.offsetLeft;
         menuBottom =  eOpenMenu.offsetTop + eOpenMenu.offsetHeight;
         comboRight =  objLeft+obj.offsetWidth
         
         if ( menuBottom > objTop && menuBottomRight > objLeft && comboRight > menuBottomLeft )
           obj.style.display = "none";
        }
       }
      }
     }
    //Closes the Menu by hiding the Div
     function CloseMenu(eMenu)
     {
      eMenu.style.display = "none";
      eOpenMenu = null;
      var selColl = document.all.tags("SELECT");
      //Rerives collection for all the Select tags in the document
       if (selColl!=null)
       {
        for (i=0; i<selColl.length; i++) 
         selColl[i].style.display = "block";
       }
     }
     
    //Open Menu Function Controls the Menu Position
     function OpenSubMenu(eSrc,eMenu)
     {
      var left = eSrc.offsetParent.offsetLeft;
      var screenwidth = screen.width - 200;
      
      if (left < screenwidth)
      {
       eMenu.style.left = 115; 
      }
      else
      {
       eMenu.style.left = -125;
      }
      
      // + divMenuBar.offsetLeft-8;
      eMenu.style.top = eSrc.offsetTop;  //offsetHeight + divMenuBar.offsetTop; //+35;
      eMenu.style.display = "none";
      eOpenSubMenu = eMenu;
      
      
      var selColl = document.all.tags("SELECT");
      var obj
      //Rerives collection for all the Select tags in the document
       if (selColl!=null)
       { 
        for (i=0; i<selColl.length; i++) 
        { //selColl[i].style.display = "none";
         //Hides the combos (Select tag) 
         obj = selColl[i]
         if (! obj || ! obj.parentElement)
         continue;
         // Find the element's offsetTop and offsetLeft relative to the BODY tag.
         objLeft   = obj.offsetLeft;
         objTop    = obj.offsetTop;
         objParent = obj.parentElement;
         while (objParent.tagName.toUpperCase() != "BODY")
         {
          objLeft  += objParent.offsetLeft;
          objTop   += objParent.offsetTop;
          objParent = objParent.parentElement;
         }
         // Adjust the element's offsetTop relative to the dropdown menu
         menuTop = divMenuBar.offsetHeight + divMenuBar.parentElement.parentElement.offsetTop+56 + eOpenSubMenu.offsetTop;
         menuLeft = eOpenSubMenu.parentElement.offsetLeft + eOpenSubMenu.offsetLeft;
         menuRight = menuLeft+ eOpenSubMenu.offsetWidth;
         menuBottom =  menuTop + eOpenSubMenu.offsetHeight;
         comboRight =  objLeft+obj.offsetWidth;
         
         if ( menuBottom > objTop && menuRight > objLeft && comboRight > menuLeft && menuTop < objTop+obj.offsetHeight)
          obj.style.display = "block"; 
         
        }
       }
     }
    //Closes the Menu by hiding the Div
     function CloseSubMenu(eMenu)
     {
      eMenu.style.display = "none";
      eOpenSubMenu = null;
        var selColl = document.all.tags("SELECT");
      //Rerives collection for all the Select tags in the document
       if (selColl!=null)
       {
        for (i=0; i<selColl.length; i++) 
         selColl[i].style.display = "block";
       }
        HideMenuCombos()
     }
    //Docuemnt Mouse Over event of the Menu Control
    document.body.onmouseover = function(e)
    {
    var elem = e?e:event;
    var eSrc = elem.target?elem.target:elem.srcElement;
    if(eSrc!=null)
    {
    if (eSrc.className == "clsMenuBarItem")
    {
    eSrc.style.color = "#00196A"; 
    var eMenu = document.getElementById(eSrc.id.replace("tdMenuBarItem","divMenu"));
    if (eOpenMenu && eOpenMenu != eMenu) 
    {
    CloseMenu(eOpenMenu);
    }
    if (eMenu) 
    {
    OpenMenu(eSrc,eMenu);
    }
    }
    else if (eOpenMenu && !OpenMenu.contains(eSrc) && !divMenuBar.contains(eSrc)) 
    {
    CloseMenu(eOpenMenu);
    }
    if (eSrc.className == "clsMenuGroupItem")
    {
    var tdArrow = document.getElementById(eSrc.id.replace("divMenuItem","tdArrow"));
    tdArrow.style.backgroundColor = "#d3d8e7";
    eSrc.style.backgroundColor = "#d3d8e7";
    var eMenu = document.getElementById(eSrc.id.replace("divMenuItem","divSubMenu"));
    if (eOpenSubMenu && eOpenSubMenu != eMenu) 
    {
    CloseSubMenu(eOpenSubMenu);
    }
    if (eMenu) 
    {
    OpenSubMenu(eSrc,eMenu);
    }
    }
    else if (eOpenSubMenu && !eOpenSubMenu.contains(eSrc))// && !divMenuBar.contains(eSrc)) 
    {
    CloseSubMenu(eOpenSubMenu);
    }
    }
    }
    //Docuemnt Mouse Out event of the Menu Control 
     document.body.onmouseout = function(e)
     {
      var elem = e?e:event;
      var eSrc = elem.target?elem.target:elem.srcElement;
      if(eSrc!=null)
      {
       if (eSrc.className == "clsMenuBarItem")
       {
        eSrc.style.color = ""; 
       }
       if (eSrc.className == "clsMenuGroupItem")
       {
        eSrc.style.color = "";
        eSrc.style.backgroundColor = "#ffffff";
        var tdArrow = document.getElementById(eSrc.id.replace("divMenuItem","tdArrow"));
        tdArrow.style.backgroundColor = "#ffffff";
       }
      }
     }
    //Function sets the BG Color of the menu items
     function setbgcolor(objSrc, blnIsSubMenu)
     { 
    //  objSrc.style.background="cornflowerblue";
      objSrc.className="clsMenuItemMouseOver";
      
     }
    //Function removes the BG Color of the menu items
     function removebgcolor(objSrc, blnIsSubMenu)
     {  
      objSrc.style.background="#E7E3E7";//"ffffff";
      
      
     }
    changed parentOffsets to parentElements, switched from visibility css attribute to display, as far as i can tell, the error console must be reading incorrectly because it is a linked in script, try running in opera, the error console is much more helpful (assuming you're running ie)
    -Mike
    "Want me to precludify him, like some kind of dispatcherator?... Can do!" -Bender

  • #10
    New Coder
    Join Date
    Mar 2008
    Posts
    21
    Thanks
    2
    Thanked 0 Times in 0 Posts
    thanks for replying so quickly, but after doing what you suggested the menus stopped working in FF all together. They wouldn't drop down at all.
    Also, I am using the error console in FF, I am also using Firebug.
    thanks
    -Will

  • #11
    Regular Coder mjlorbet's Avatar
    Join Date
    Jan 2008
    Location
    Milwaukee, WI
    Posts
    724
    Thanks
    8
    Thanked 96 Times in 95 Posts
    it's just that the trace that you got out of it doesn't make any sense, an object that is never followed by an opening parenthesis is giving you a not a function error on a line where the variable isn't used, the problem is likely in the markup, not the script as it is.
    -Mike
    "Want me to precludify him, like some kind of dispatcherator?... Can do!" -Bender

  • #12
    New Coder
    Join Date
    Mar 2008
    Posts
    21
    Thanks
    2
    Thanked 0 Times in 0 Posts
    OH! I'm sorry i put in the wrong line of code, stupid mistake.
    This is the real code giving me the error.
    Code:
    else if (eOpenMenu && !eOpenMenu.contains(eSrc) && !divMenuBar.contains(eSrc))
    and the error is:
    "eOpenMenu.contains is not a function"

    I have narrowed it down and this is the part of the code that is giving me the problem of the menus not collapsing when I move the mouse out, I just need to figure out a way to write it for FF.

    BTW Thanks for sticking with me on this.

    -Will

  • #13
    Regular Coder mjlorbet's Avatar
    Join Date
    Jan 2008
    Location
    Milwaukee, WI
    Posts
    724
    Thanks
    8
    Thanked 96 Times in 95 Posts
    no problem, it's fun

    anyways, isn't eOpenMenu a reference to an html element? html elements don't have a contains method. so that'd be the problem

    Code:
     
    function htmlChildNodesContains(htmle, obj){
    var cnc = htmle.childNodes;
    var found = false;
    for(var i = 0; i < cnc.length; i++)
        if(cnc[i] == obj)
            found = true;
    return found;
    }
    so you could do htmlChildNodesContains(eOpenMenu, eSrc) in the if statement to see if eOpenMenu contains a child that matches eSrc
    -Mike
    "Want me to precludify him, like some kind of dispatcherator?... Can do!" -Bender

  • #14
    New Coder
    Join Date
    Mar 2008
    Posts
    21
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Great that worked, It got rid of that error, now I'm getting the same error for
    Code:
    !divMenuBar.contains(eSrc)
    in that same if statement, I'm gonna try the same sort of method. does that sound like it would work?
    -Will

  • #15
    New Coder
    Join Date
    Mar 2008
    Posts
    21
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Well that worked for that error too, but the menu still doesn't close when I mouseout... any ideas why? My guess would be the various occurrences of:
    Code:
    document.all.tags
    **Update**
    I replaced those document.alls with document.getElementById, and now I'm down to 1 error
    "Element reference by ID/NAME in the global scope. Use W3C standard document.getElementById() instead" on these four lines:
    (1)
    Code:
    else if (eOpenMenu && htmlChildNodesContains(eOpenMenu, eSrc) && htmlChildNodesContains(divMenuBar, eSrc))
    (2)
    Code:
    eMenu.style.left = eSrc.offsetLeft + divMenuBar.offsetLeft;
    (3)
    Code:
    if(divMenuBar.offsetParent.offsetParent!=null)
    (4)
    Code:
    eMenu.style.top = divMenuBar.offsetHeight + divMenuBar.offsetParent.offsetParent.offsetTop;
    any Ideas?
    -Will
    Last edited by bigbird8891; 04-23-2008 at 10:55 PM.


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •