PDA

View Full Version : Halo template - 'menuitem1' is undefined in IE due to mouseover


Chris
01-11-2009, 03:14 AM
I am getting a " 'menuitem1' is undefined " error in IE when my page loads (only if you move the mouse while the page is loading) due to the DW Halo mouseover commands monitoring mouse movement prior to menuitem1 getting defined by the java.

I have seen many discussions about this, and I can understand why it is happening, but I can't find a fix.

I am hoping someone may have a sugestion:

www.generatorpanels.com (http://www.generatorpanels.com)


Located just inside <head>:

<script type="text/javascript">
<!--
var time = 3000;
var numofitems = 6;
//menu constructor
function menu(allitems,thisitem,startstate){
callname= "gl"+thisitem;
divname="subglobal"+thisitem;
this.numberofmenuitems = 6;
this.caller = document.getElementById(callname);
this.thediv = document.getElementById(divname);
this.thediv.style.visibility = startstate;
}
//menu methods
function ehandler(event,theobj){
for (var i=1; i<= theobj.numberofmenuitems; i++){
var shutdiv =eval( "menuitem"+i+".thediv");
shutdiv.style.visibility="hidden";
}
theobj.thediv.style.visibility="visible";
}

function closesubnav(event){
if ((event.clientY <173)||(event.clientY > 238)){
for (var i=1; i<= numofitems; i++){
var shutdiv =eval('menuitem'+i+'.thediv');
shutdiv.style.visibility='hidden';
}
}
}
// -->
</script>


Located just inside <body>:

<body onmousemove="closesubnav(event);">



Located at bottom of page:

<script type="text/javascript">
<!--
var menuitem1 = new menu(6,1,"hidden");
var menuitem2 = new menu(6,2,"hidden");
var menuitem3 = new menu(6,3,"hidden");
var menuitem4 = new menu(6,4,"hidden");
var menuitem5 = new menu(6,5,"hidden");
var menuitem6 = new menu(6,6,"hidden");
// -->
</script>