Todd Cary wrote:[color=blue]
> I inherited an application where the Flyout works in Firefox but not in
> IE. My JavaScript background is sparse, so I am not sure how to
> approach the problem. Any suggestions are welcomed!
>
> The performance can be viewed at
>
>
http://209.204.172.137/casesearch/php/all.php
>
> Here is the base javascript
:
>
> function InitMenu()
> {
> if (document.all["menuBar"])
> {
> }
> else
> {
> return;
> }
> document.onclick=HideMenuBar;
> var bar = menuBar.children;
> for(var i=0;i < bar.length;i++)
> {
> var menuName = bar[i].menu;
> if (menuName != null)
> {
> bar[i].onmouseover = new Function("ShowMenu("+bar[i].id+")");
> var menu=eval(menuName);
> menu.style.visibility = "hidden";
> var Items = menu.children;
> for(var j=0; j<Items.length; j++)
> {
> var menuItem = eval(Items[j].id);
> if(menuItem.menu != null)
> {
> if (menuItem.innerHTML.indexOf("_Arrow",1) < 1)
> {
> // menuItem.innerHTML += "<Span
> Id="+menuItem.id+"_Arrow class='Arrow'> 4</Span>" ;
> //menuItem.innerHTML += "<Span
> Id="+menuItem.id+"_Arrow class='Arrow'><img
> src='../gif/menu_arrow.gif'></Span>" ;
> menuItem.innerHTML += "<img class='Arrow'
> src='menu_arrow.gif'>" ;
> }
> FindSubMenu(menuItem.menu);
> }
>
> if(menuItem.cmd != null)
> {
> menuItem.onclick = new Function("Do("+menuItem.id+")");
> }
>
> menuItem.onmouseover = new
> Function("highlight("+Items[j].id+")");
> }
> } else
> {
> bar[i].onmouseover = new Function("ShowBar("+bar[i].id+")");
> }
> if (bar[i].cmd != null)
> {
> bar[i].onclick = new Function("Do("+bar[i].id+")");
> }
> }
> }
>
> function FindSubMenu(subMenu)
> {
> var menu=eval(subMenu);
> var Items = menu.children;
> for(var j=0; j<Items.length; j++)
> {
> menu.style.visibility = "hidden";
> var menuItem = eval(Items[j].id);
>
> if(menuItem.menu!= null)
> {
> menuItem.innerHTML += "<img class='Arrow'
> src='menu_arrow.gif'>" ;
> FindSubMenu(menuItem.menu);
> }
>
> if(menuItem.cmd != null)
> {
> menuItem.onclick = new Function("Do("+menuItem.id+")");
> }
>
> menuItem.onmouseover = new
> Function("highlight("+Items[j].id+")");
> }
> }
>
> function ShowMenu(obj)
> {
> HideMenu(menuBar);
> var menu = eval(obj.menu);
> var bar = eval(obj.id);
> bar.className="barOver";
> menu.style.visibility = "visible";
> menu.style.pixelTop = obj.getBoundingClientRect().top +
> document.body.scrollTop +3;
> menu.style.pixelLeft = obj.getBoundingClientRect().right +
> document.body.scrollLeft - 5;
> if (obj.cmd != null)
> {
> window.status = obj.cmd;
> }
> }
>
> function highlight(obj)
> {
> var PElement = eval(obj.parentElement.id);
> if(PElement.hasChildNodes() == true)
> {
> var Elements = PElement.children;
> for(var i=0;i<Elements.length;i++)
> {
> TE = eval(Elements[i].id);
> TE.className = "menuItem";
> }
> }
> obj.className="ItemMouseOver";
> ShowSubMenu(obj);
> if (obj.cmd != null)
> {
> window.status = obj.cmd;
> } else window.status = "";
>
> }
>
> function Do(obj)
> {
> var cmd = eval(obj).cmd;
> var new_browser = eval(obj).nb;
> if (new_browser=="1")
> {
> window.open(cmd);
> } else window.navigate(cmd);
> }
>
> function HideMenu(obj)
> {
> window.status = '';
> if(obj.hasChildNodes()==true)
> {
> var child = obj.children;
>
> for(var j =0;j<child.length;j++)
> {
> if (child[j].className=="barOver")
> {
> var bar = eval(child[j].id);
> bar.className="Bar";
> }
>
> if(child[j].menu != null)
> {
> var childMenu = eval(child[j].menu);
> if(childMenu.hasChildNodes()==true)
> HideMenu(childMenu);
> childMenu.style.visibility = "hidden" ;
> }
> }
> }
> }
>
> function ShowSubMenu(obj)
> {
> PMenu = eval(obj.parentElement.id);
> HideMenu(PMenu);
> if(obj.menu != null)
> {
> var menu = eval(obj.menu);
> menu.style.visibility = "visible";
> menu.style.pixelTop = obj.getBoundingClientRect().top +
> document.body.scrollTop +3;
> menu.style.pixelLeft = obj.getBoundingClientRect().right +
> document.body.scrollLeft - 5;
> if(menu.getBoundingClientRect().right > window.screen.availWidth )
> menu.style.pixelLeft = obj.getBoundingClientRect().left -
> menu.offsetWidth;
> }
> }
>
> function HideMenuBar(e)
> {
> HideMenu(menuBar);
> }
>
> function ShowBar(obj)
> {
> HideMenu(menuBar);
> if (obj.cmd != null)
> {
> window.status = obj.cmd;
> obj.className="barOver";
> }
> }[/color]
I mixed up which Browser works and does not: it works with IE but *not*
with Firefox. The problem appears to be with the property, "children",
in the above code. This line works in IE but not in Firefox:
var bar = menuBar.children;
alert("Got to here " + bar.length.toString());
Now I am not sure how to fix this if I identify that the app is running
in Firefox.
Todd