473,883 Members | 2,121 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Drop-down menu in IE using Javascript

2 New Member

I am not at all experienced in Javascript so please bear with me. I'm trying to create a drop-down menu that will work in IE, and trying to use some Javascript code that I got from here. It is supposed to make the menu show up by mouseover. Unfortunately nothing happens (no error codes either) - I don't see the menu when I roll over the title with the mouse (although it works in Firefox, so I know the problem is with the IE-specific Javascript code).

I have found using
Expand|Select|Wrap|Line Numbers
  1. alert(navRoot.childNodes.length);
that it is correctly identifying that there are 6 items in the menu. So it is at least executing the for loop.

Your help in getting this to work would be greatly appreciated - I'm developing a website for a children's charity in Africa if that adds motivation!

Many thanks,

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  4. <script type="text/javascript">
  5. startList = function() {
  6. if (document.all&&document.getElementById) {
  7. navRoot = document.getElementById("nav");
  8. for (i=0; i<navRoot.childNodes.length; i++) {
  9. node = navRoot.childNodes[i];
  10. if (node.nodeName=="LI") {
  11. node.onmouseover=function() {
  12. this.className+=" over";
  13.   }
  14.   node.onmouseout=function() {
  15.   this.className=this.className.replace(" over", "");
  16.    }
  17.    }
  18.   }
  19.  }
  20. }
  21. window.onload=startList;
  22. </script>
  24. <style>
  26. ul { padding: 0; margin: 0; list-style: none }
  27. li { float: left; position: relative; width: 11em }
  28. li ul { display: none; position: absolute; top: 1em; left: 0 }
  29. li > ul {
  30.     top: auto;
  31.     left: auto;
  32.     }
  33. li:hover ul, li.over ul{ display: block }
  34. </style>
  36.  </head> 
  37.  <body>
  39.       <ul>
  40.   <li>About WKU
  41.     <ul id="nav">
  42.       <li><a href="">History</a></li>
  43.       <li><a href="">Programs</a></li>
  44.       <li><a href="">Locations</a></li>
  45.       <li><a href="">Sponsors &amp; Supporters</a></li>
  46.       <li><a href="">Staff</a></li>
  47.       <li><a href="">Volunteers</a></li>
  48.         </ul>
  49.     </li>
  50. </ul>
  51. </body>
  52. </html>
Sep 3 '08 #1
3 1544
16,027 Recognized Expert Moderator MVP
The id should be for the top-most ul.
Sep 3 '08 #2
2 New Member
Awesome, thanks a mil! I had tried that before but I think there was another bug at the time.

The id should be for the top-most ul.
Sep 3 '08 #3
16,027 Recognized Expert Moderator MVP
You're welcome. Post again if you have more questions.
Sep 3 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Sabrina | last post by:
Hi everybody, I need some help in SQL Server. I am looking for a command that will "Drop all user table" in a user database. Can anyone help me? Thank you very much Sabrina
by: Ian Dobson | last post by:
Hi, I need to drop a schema from a database but it has 400 tables in it. Is there an easy way to do it other than drop table schema1.table1 drop table schema1.table2 etc.. to 400 and then drop schema schema1? thanks
by: BuddhaBuddy | last post by:
Platform is DB2/NT 7.2.9 The table was created like this: CREATE TABLE MYTEST ( MYTESTOID bigint not null primary key, FK_OTHEROID bigint not null references other, FK_ANOTHEROID bigint not null references another, FK_LASTLYOID bigint not null references lastly, unique (FK_OTHEROID,FK_ANOTHEROID))
by: Torre Quinn | last post by:
Does anyone have any good sites or resources dealing with adding drag and drop functionality to a set of controls on a form? I'd like to try to get several examples of varied applications of drag and drop being used on different types of controls. My current task is this. I have a treeview control and a data grid control. The data grid has two fields, 'value' and 'name'. I want to be able to drag nodes from the tree view and drop them...
by: ViRi | last post by:
I am currently experimenting a bit with AxMicrosoft.MediaPlayer.Intero­p.AxWindowsMediaPlayer and so far, most has gone well. Currently, i would like to add drag-and-drop functionality to the program, but the ActiveX has no support for it, so trying to use it just causes error's. What i have done is use a small label that i use for displaying current progress in the media file to use the drag-and-drop functionality.
by: Markus | last post by:
I tried this: ALTER TABLE Dokumente DROP COLUMN docPrioID but I get this errormessage: DB2 SQL error: SQLCODE: -104, SQLSTATE: 42601, SQLERRMC: COLUMN;ABLE Dokumente DROP;CONSTRAINT
by: joey.powell | last post by:
I have a Windows Forms application where I need to be able to drag and then drop onto a datagridview control. I already have the code necessary to make the drag part work. I am having problems, however, when I attempt to drop onto a cell in the datagridview. So far I have done the following with the datagridview control... 1. I set "AllowDrop" to true. 2. In the DragEnter event I put this...
by: pagelogix | last post by:
I'm looking for a way to drop multple tables at the same time from my access database. Any ideas? Thanks.
by: Thi | last post by:
Hi, I am trying to develop an application that allows the users to drag a few file(s) from a zip archive to a destination. My question is, how do i determine where the drop destination is because i need to do some validation checking before extracting the files from the zip archive (e.g. validate archive password). Any help or some sample codes would be very much appreciated.
by: sreemati | last post by:
Hi I am working on SQL SERVER 200 and I am trying to drop the default constraints set in few tables. I tired to follow the instructions given in MSDN for dropping a default: 1) Unbind the code Exec sp_unbindefault 'tablename.columname' When I try to run it, it gives me following this error message: Server: Msg 15049, Level 11, State 1, Procedure sp_unbindefault, Line 98
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.