Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8228305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:25:10+00:00 2026-06-07T16:25:10+00:00

I took some sample code to create a drop down menu from this website:

  • 0

I took some sample code to create a drop down menu from this website: http://www.javascriptkit.com/script/script2/verticalmenu.shtml

I have been editing it so that the main menu would use my own image (instead of their repeated green one) and then the drop down menus would be a large gray block (instead of their repeated green one again).

I’ve been able to insert my own image for the main menu and also have a successful gray block rollover drop down menu.

THE PROBLEM: When I test my page, it starts with the drop down menu open. I think the problem is somewhere inside my CSS/HTML manipulation. Should I change what is going on in my javascript? I noticed that it is calling up the UL tag.

This is the picture when I load my page:

http://imageshack.us/photo/my-images/850/hoverproblem.png/

This is the picture of it working properly after being rolled over:

http://imageshack.us/photo/my-images/152/hoverproblem2.png/

HTML:

<ul id="verticalmenu" class="glossymenu">
<li style="height:30px;"><a href="#" style="text-decoration:none;"></a>
  <ul id="submenu">
    <li id="submenuli"><a href="#" style="color:white; font: bold 12px Verdana, Helvetica,    sans-serif;">JavaScript Reference</a></li>
    <li id="submenuli"><a href="#">DOM Reference</a></li>
    <li id="submenuli"><a href="#">CSS Reference</a></li>
  </ul>
</li>

CSS:

.glossymenu, .glossymenu li ul {
list-style-type: none;
margin: 0;
padding: 0;
width: 276px; /*WIDTH OF MAIN MENU ITEMS*/
height: 30px;
}

.glossymenu li{
position: relative;
}

.glossymenu li ul{
background: url(../Kruger%20Optical/images/tacdriver/riflenav.png);
font: bold 12px Verdana, Helvetica, sans-serif;
color: white;
display: block;
width: 276px;
height: 30px;
text-decoration: none;
}

/* SUBMENU AND SUBMENULI is the drop down menu that keeps appearing when i load the page */

#submenu { /*SUB MENU STYLE*/
position: absolute;
background-color: #373737;
height: 300px;
width: 300px; /*WIDTH OF SUB MENU ITEMS*/
left: 0;
top: 0;
display: hidden;
}

#submenuli {
position: relative;
list-style-type: none;
margin: 0;
width: 300px; /*WIDTH OF MAIN MENU ITEMS*/
height: 20px;
display: hidden;
padding:15px;
font: bold 12px Verdana, Helvetica, sans-serif;
color: white;
float: left;
}

.glossymenu li ul li{
float: left;
}

JAVASCRIPT:

var menuids=new Array("verticalmenu") //Enter id(s) of UL menus, separated by commas
var submenuoffset=-2 //Offset of submenus from main menu. Default is -2 pixels.

function createcssmenu(){
for (var i=0; i<menuids.length; i++){
  var ultags=document.getElementById(menuids[i]).getElementsByTagName("ul")
    for (var t=0; t<ultags.length; t++){
    var spanref=document.createElement("span")
    spanref.innerHTML="&nbsp;&nbsp;"
    ultags[t].parentNode.getElementsByTagName("a")[0].appendChild(spanref)
ultags[t].parentNode.onmouseover=function(){
this.getElementsByTagName("ul")    [0].style.left=this.parentNode.offsetWidth+submenuoffset+"px"
this.getElementsByTagName("ul")[0].style.display="block"
}
ultags[t].parentNode.onmouseout=function(){
this.getElementsByTagName("ul")[0].style.display="none"
    }
    }
      }
}


if (window.addEventListener)
window.addEventListener("load", createcssmenu, false)
else if (window.attachEvent)
window.attachEvent("onload", createcssmenu)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T16:25:12+00:00Added an answer on June 7, 2026 at 4:25 pm

    you have set display: block; on #submenu. That tells the rendering engine to display it as a block element. You want it hidden when the page first loads, so your stylesheet should contain this rule for #submenu:

    display: none;

    You’ll then need a snippet of JavaScript that will make #submenu visible when the user hovers their mouse over the <li> element in the main menu bar.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So, I took some code from this Microsoft provided Example which allows me to
I took the example code from the Kendo UI demos at http://demos.kendoui.com/web/grid/remote-data.html , binding
I took two simple examples from Google Maps v.3 Documentation https://code.google.com/apis/maps/documentation/javascript/examples/maptype-base.html google-maps-utility-library-v3.googlecode.com/svn/tags/markermanager/1.0/examples/weather_map.html And I
I took some code here: Check if role consists of particular user in DB?
It took me a while, and some help from Apple (one instruction I missed),
So I took some php code and turned it into a calendar with a
We tried last night to build some code which would create a new public
Is there Java class or some sample code that can convert a java Date
In AS3, Array.sort() took some nice sorting options like: Array.DESCENDING - sorts the array
it took me some time to find out that both Eclipse and Aptana get

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.