div tag problem

Web site design & management
i am a novice in web-designing field. i have put following <div></div> tag on one of my site page which create a drop down menu on putting mouse over the main menu code: <div onMouseOver="HappiMenuActive()" onmouseout="HappiMenuNoShow()"> <a href="cybersys.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image4','','cybDN.jpg',1)"> <img src="cybUP.jpg" alt="Cyber System" name="Image4" width="193" height="100" border="0" align="top"> </a> </div> <div id="hpcmenu" style="Position:absolute; left:5; top:378; visibility:hidden" onmouseover="HappiMenuActive()" onmouseout="HappiMenuNoShow()"> <a href="mysource.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image4A','','img45MO.gif',1)"> <img src="img45.gif" alt="My Sources" name="Image4A" width="119" height="22" border="0"></a><br> <a href="mywork.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image4B','','img46MO.gif',1)"> <img src="img46.gif" alt="My Work" name="Image4B" width="119" height="22" border="0"></a> </div> in script tag (javascript): function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; } function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } function HappiMenuActive() { document.all.hpcmenu.style.visibility="visible"; } function HappiMenuNoShow() { document.all.hpcmenu.style.visibility="hidden"; } problem is, this code works ok on windows platform with IE 6 (or also might be on some lower versions of IE, i did'nt check). but this does not work on macintosh using IE Version 5.2 What could be the problem. can anybody help me with solution which works on all platform/browsers. thank you in advance

Answer Wiki

Thanks. We'll let you know when a new response is added.

the problem is the way you are referencing the div tag in your javascript

there is several ways to do it, but all only work with some browsers and not others

document.getElementById(‘hpcmenu’).style.visibility=”” works for newer versions of most browsers

document.hpcmenu.style.visibility=”” will work for ie 4x onwards

if you do a test for browser version, you should be able to select between the statements so that it will work in all browsers

Discuss This Question:  

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: