i'm new to this and i'm not too familiar with the DOM and compatibility issues with different browsers. but i have this script (from codespy.com) that lays out a menu...
then...Code:function layoutMenu() { for (i=1; i<=numLayer; i++) { writeThis=""; writeThis+=("<DIV id='"+layerName+""+i+"' onMouseOver=\"showMenu('"+layerName2+""+i+"')\" onMouseOut=\"hidemenuTimer('"+layerName2+""+i+"')\">") writeThis+=("<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=\""+layerWidth+"\" HEIGHT=\""+layerHeight+"\" BGCOLOR=\""+TitleColor+"\">"); writeThis+=("<TR><TD> <A HREF=\"\" onMouseOver=\"showMenu('"+layerName2+""+i+"');this.className='menuOver';window.status='"+menuTitles[i-1]+"';\" onMouseOut=\"hidemenuTimer('"+layerName2+""+i+"');this.className='menuOut';window.status='"+menuTitles[i-1]+"';\" CLASS='menuOut'>"+menuTitles[i-1]+"</A></TD></TR>"); writeThis+=("</TABLE></DIV>") writeThis+=("<DIV id='"+layerName2+""+i+"' onMouseOver=\"showMenu('"+layerName2+""+i+"')\" onMouseOut=\"hidemenuTimer('"+layerName2+""+i+"')\">") writeThis+=("<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=\""+eval("menu"+i+"width")+"\" BGCOLOR=\""+menuColor+"\">"); numLowerMenu=eval("menu"+i+"menuTitles.length") for (j=0; j<numLowerMenu; j++) { writeThis+=("<TR><TD "+styleForTDelement+" onClick=\"self.location.href='"+eval("menu"+i+"Links["+j+"]")+"'\" onMouseOver=\"this.style.backgroundColor='"+menuColorMouseOver+"'\" onMouseOut=\"this.style.backgroundColor=''\"><A HREF=\""+eval("menu"+i+"Links["+j+"]")+"\" onMouseOver=\"showMenu('"+layerName2+""+i+"')\" onMouseOut=\"hidemenuTimer('"+layerName2+""+i+"')\" CLASS='menuOut'> "+eval("menu"+i+"menuTitles["+j+"]")+"</A></TD></TR>") } writeThis+=("</TABLE></DIV>") document.write(writeThis); } }
it "places" the menu and sets it as visible or invisible. the thing is... it only works on IE. Not Mozilla or NS. I tried the getElementID but that still doesnt work? what am i doing wrong? can somebody help?Code:function placeMenu() { for (i=1; i<=numLayer; i++) { if (document.all) { beginLayer=document.all[layerName+i].style; } else { beginLayer=document.layers['layerName+i']; } beginLayer.width=layerWidth beginLayer.height=layerHeight beginLayer.top=pixelDown beginLayer.left=pixelLeft+layerWidth*(i-1); beginLayer.visibility="visible"; if (document.all) { beginLayer=document.all[layerName2+i].style; } else { beginLayer=document.layers[layerName2+i]; } beginLayer.width=layerWidth beginLayer.top=pixelDown+layerHeight beginLayer.left=pixelLeft+layerWidth*(i-1); beginLayer.visibility="hidden"; } }
the line "beginLayer=document.all[layerName+i].style;" keeps giving me "document.all[layerName+i] has no properties" or "document.getElementID[layerName+i] has no properties" in the Mozilla Javascript console?![]()
thanks in advance.



Reply With Quote
Bookmarks