Jump to content

Drop down menu appears different in IE (JS and CSS menu)


SlickAU

Recommended Posts

Hey dudes,

 

I am in the final stages of finishing this drop down menu I have made using mainly div tags, javascript and css...

 

It looks absolutely perfect in Firefox, but when you open it up in IE, the dropdown function does not work properly and the css doesn't kick in properly.  ???

 

Here is the code for the page:

 

<div id='topnav'>

<div id="navcontainer">
<div id="navbox" onmouseover="dropdown('1')" onmouseout="drophide()">Application

<div id="navdrop" onmouseover="dropdown('1')" onmouseout="drophide()">
<a href="database/" class="menuitem">Database</a>
</div>
<div id="navdrop1" onmouseover="dropdown('1')" onmouseout="drophide()">
<a href="#" class="menuitem">Frame Editor</a>
</div>
</div>
<div id="navbox" onmouseover="dropdown('2')" onmouseout="drophide()">Websites
<div id="navdrop2" onmouseover="dropdown('yes')" onmouseout="drophide()">
<a href="?p=websites" class="menuitem">View</a>
</div>
</div>
<div id="navbox"><a href="?p=media" class="menuitem">Media</a>
</div>
<div id="navbox"><a href="?p=contact" class="menuitem">Contact</a></div>
</div>
</div>

 

and here is the CSS:

 

#topnav {

margin:0;
padding:0;
height:20px;
width:100%;
background-color:#87c8fb;
z-index:1;

}

#navcontainer {

margin-left:220px;
float:left;
z-index:1;
position:relative;
height:20px;

}

#navbox {

width:120px;
height:17px;
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:12px;
font-weight:bold;
text-align:center;
color:#FFFFFF;
padding-top:2px;
float:left;
text-decoration:none;


}

#navbox:hover {

background-color:#666666;
border-botcument.getElementById("navdrop1").style.visibility = "visible"

}

else if (number =="2") {


document.getElementById("navdrop2").style.visibility = "visible";

}

}

function drophide() {

document.getElementById("navdrop").style.visibility = "hidden"
document.getElementById("navdrop1").style.visibility = "hidden"
document.getElementById("navdrop2").style.visibility = "hidden"

}



</script>

 

Any help would be much appreciated....

 

Thanks  :D

Link to comment
Share on other sites

#navbox:hover {

 

background-color:#666666;

border-botcument.getElementById("navdrop1").style.visibility = "visible"

 

}

 

else if (number =="2") {

 

I don't understand what you're doing here... mixing CSS and JavaScript ? ? ?

In IE this gives lots of errors... In FireFox, the CSS hover works, but the visibility of the menues is always on (no dropdown).

 

I'd separate out the CSS from the JS... maybe that would fix your issue.

Link to comment
Share on other sites

I don't understand what you're doing here... mixing CSS and JavaScript ? ? ?

 

Woops this was a mistake i made on the post itself...the code is actually seperate...

 

Here is the CCS Code:

 

#topnav {

margin:0;
padding:0;
height:20px;
width:100%;
background-color:#87c8fb;
z-index:1;

}

#navcontainer {

margin-left:220px;
float:left;
z-index:1;
position:relative;
height:20px;

}

#navbox {

width:120px;
height:17px;
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:12px;
font-weight:bold;
text-align:center;
color:#FFFFFF;
padding-top:2px;
float:left;
text-decoration:none;


}

#navbox:hover {

background-color:#666666;
border-bottom:1px solid #333333;
border-top:1px solid #333333;
color:#FFFFFF;

}

#navdrop {

height:18px;
width:120px;
color:white;
background-color:#87c8fb;
padding-top:5px;
margin-top:4px;
visibility:hidden;

}

#navdrop:hover {

color:#FFFFFF;
background-color:#666666;

}

#navdrop1 {

height:18px;
width:120px;
color:white;
background-color:#87c8fb;
padding-top:5px;
border-bottom:1px solid #333333;
visibility:hidden;

}

#navdrop1:hover {

color:#FFFFFF;
background-color:#666666;

}

#navdrop2 {

height:18px;
width:120px;
color:white;
background-color:#87c8fb;
padding-top:5px;
margin-top:4px;
visibility:hidden;
border-bottom:1px solid #333333;

}

#navdrop2:hover {

color:#FFFFFF;
background-color:#666666;

}

 

and here is the Javascript:

 

<script language="javascript" type="text/javascript">

 

function dropdown(number) {

 

if (number == "1") {

 

document.getElementById("navdrop").style.visibility = "visible"

document.getElementById("navdrop1").style.visibility = "visible"

 

}

 

else if (number =="2") {

 

 

document.getElementById("navdrop2").style.visibility = "visible";

 

}

 

}

 

function drophide() {

 

document.getElementById("navdrop").style.visibility = "hidden"

document.getElementById("navdrop1").style.visibility = "hidden"

document.getElementById("navdrop2").style.visibility = "hidden"

 

}

 

 

 

</script>

 

Also here is the LIVE link for the page itself:

http://www.theslick.com/portfolio/v2

 

Hope this clears it up a bit..

 

Thanks again,

Slick  ;D

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.