html - Javascript Cannot read property 'document' of undefined -


i've inherited else's web site , i'm trying resolve why javascript-based rollover menu doesn't work in ie (compatability mode enabled).

the code, via included menu.js:

function gomenu(m,n){  if(n){   showmenu(m);  }else{   hidemenu(m,n);  } }  function showmenu(m) {    for(i=0;i<6;i++){       if (i!=m){          hidemenu(i);       }    }     if(document.all){       eval('document.all.menu'+m+'.style.visibility="visible"');    }else{       eval('document.menuspan.document.menu'+m+'.visibility="show"');    } }  function hidemenu(m) {    if(document.all){       eval('document.all.menu'+m+'.style.visibility="hidden"');    }else{       eval('document.menuspan.document.menu'+m+'.visibility="hide"');    } } 

and code in html file basic

<span id="menu0" onmouseout="gomenu(0,0);" onmouseover="gomenu(0,1);">      <layer onmouseout="gomenu(0,0);">      ...      </layer> </span> 

this worked fine years in ie (latest version needs compatability mode enabled), , never worked in firefox or chrome aware of. business owners want me make work in browsers. i'm not javascript person i'm not sure errors javascript console mean:

from ie: unable property 'document' of undefined or null reference  chrome: uncaught typeerror: cannot read property 'document' of undefined 

i have tried tweaking code in menu.js no avail. javascript experience able tell me make code work latest browsers, if anything?

i guess it's 1 of document.menuspan.document operations. document.menuspan undefined. it's not part of api.


Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -