简体   繁体   中英

From Internet Explorer 6 to Google Chrome

I am working on an old web application (initially developed for Internet Explorer 6, now upgraded for Internet Explorer 8) and I need to assure compatibility on Mozilla Firefox and Google Chrome. I managed to do it for Mozilla Firefox but it is harder on Google Chrome, menu does not display and I do not know why at all. I have this kind of code (here it is for the main menu and there also is something like that for the submenus which are developed when you hover over menu items):

if((document.all)||(window.sidebar)){
        var clic="";
        var style="";
        if(this[i].url!=""){
            style="cursor:pointer;";
            clic=" onclick='window.location=\""+this[i].url+"\"'";}
        A+="<div id='main"+i+"' style='position:absolute; left:"+X+"; top:"+Y+"; "+style+"width:130px"+/*this[i].larg+*/"; height:18px"+/*this.haut+*/"; background-color:"+colBarre+"; "+cssTexte+"; text-align:center' onmouseover='start("+i+", "+this[i].mnu+", "+X+", "+(Y+this.haut+1)+")'"+clic+">"+this[i].txt+"</div>";}
    if(document.layers){
        var txt=this[i].txt;
        if(this[i].url!=""){
            txt="<a href='"+this[i].url+"'>"+txt+"</a>";}
        A+="<layer name='main"+i+"' left="+X+" top="+Y+" width=130px"+/*this[i].larg+*/" height=18px"+/*this.haut+*/" bgcolor="+colBarre+"  onmouseover='start("+i+","+this[i].mnu+", "+X+", "+(Y+this.haut+1)+")'><center><span style='background-color:"+colBarre+cssTexte+"'>"+txt+"</span></center></layer>";}
    X+=this[i].larg+1;}

After many researches on the web I still do not understand what document.layers, document.all, window.sidebar, window.getElementById and document.getElementById are, what they return exactly and what the difference between window.getElementById and document.getElementById is.

To sum up: I need information about document.layers, document.all, window.sidebar, window.getElementById and document.getElementById.

Finally, I have resolved my problem. If someone need an answer, here what I did. document.all and document.layers are both obsolete, already with Internet Explorer 6. So I used document.getElementById instead of document.all and erased all if conditions with document.layer. Last, I did not find what document.all, window.sidebar and document.getElementById return (EDIT: an answer here From Internet Explorer 6 to Google Chrome ) but my application works well on IE, MF and GC and that is what I needed so everything is OK.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM