Log In · Register

 
Javascript Problem - Drop down menu
Emmi237
post Jan 8 2008, 10:48 AM
Post #1


Member
**

Group: Member
Posts: 22
Joined: Nov 2006
Member No: 483,287



Hi.. I'm wondering if anyone can help me.....I'm building a website in my web design class at college and have come accross a problem with a javascript code I tried to create for my menu.

This is the script in my header:
CODE
<script type="text/javascript">
function showmenu(elmnt)
{
document.getElementById(elmnt).style.visibility="visible";
}
function hidemenu(elmnt)
{
document.getElementById(elmnt).style.visibility="hidden";
}
</script>


and this is the script in my HTML:
CODE
<div id="servingyou" onmouseover="showmenu('servingdrop')" onmouseout="hidemenu('servingdrop')"><a href="web.html" valign="center">Serving You</a></div>
<table class="servingtable" id="servingdrop" width="100" cellspacing="0"
onmouseover="showmenu('servingdrop')" onmouseout="hidemenu('servingdrop')">
   <tr><td class="cell"><a href="council.html">The Council</a></td></tr>
   <tr><td class="cell"><a href="minutes.html">Minutes</a></td></tr>
<tr><td class="cell"><a href="reports.html">Annual Reports</a></td></tr>
</table>

I also have this in my CSS defining the table:
CODE
table.servingtable
{
position:absolute;
top:55px;
left:282px;
visibility:hidden;
z-index:1;
}


When opened in IE6 it shows an error. And the drop down menu also appears when the mouse isn't even hovering over the button.. but only on certain areas of the page.
Can anyone help me?
 
 
Start new topic
Replies (1 - 1)
libertie
post Jan 8 2008, 03:07 PM
Post #2


This bag is not a toy.
*******

Group: Staff Alumni
Posts: 3,090
Joined: Oct 2007
Member No: 583,108



I actually don't get any errors when I test it in IE6. In IE7 my only problem was the "allow blocked content" error, which I just told to go away and it loaded fine. So basically, to me it's behaving the way it should, although I'm looking at it out of context - just text links without any styling, so I can't really tell how it's appearing within your page.

I would suggest a different way, but is javascript part of the requirements for the assignment? I didn't want to tell you to build it in CSS if you're supposed to be learning javascript. xD
 

Closed TopicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members: