# Problem with a Javascript website menu

**URL:** https://boards.straightdope.com/t/problem-with-a-javascript-website-menu/400913
**Category:** Factual Questions
**Created:** [April 20, 2007, 11:09am UTC](https://boards.straightdope.com/t/problem-with-a-javascript-website-menu/400913 "2007-04-20T11:09:13Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Schnitte](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/schnitte/32/9033_2.png) [@Schnitte](https://boards.straightdope.com/u/Schnitte)
#### Post date: [April 20, 2007, 11:09am UTC](https://boards.straightdope.com/t/problem-with-a-javascript-website-menu/400913/1 "2007-04-20T11:09:13Z")

</div>

I’m a student assistant to a professor at my university, and one of my jobs is to host the chair’s website.

We use a free Javascript menu called “coolmenu” in the top frame of a three-frame website. It’s basically a Java-based dropdown menu: You click one of the main items, and a submenu with several items which belong to that superior one drops down. Clicking one of the main items will also link to an html site on this item, the submenu items will link to different sites. It’s supposed to work like [this](http://www.uni-bayreuth.de/departments/rw/lehrstuehle/oer1/menu1.htm) (that’s the top frame from the webiste of another chair, which uses the same system).

Occasionally, I make modifications to this menu to add or delete submenu items, without changing the Javascript structure itself. Usually, this works just fine without any problems. Since a few days, however, I’m experiencing problems with the menu, most likely from a mistake of mine in the last modification, but I just don’t get what I did wrong.

Now, the result I get when I try to access the menu in a browser is [this](http://www.uni-bayreuth.de/departments/zivilrecht8/menueng.htm) - a German note saying that the browser doesn’t support Javascript (which isn’t true, as the menu on the other webiste works just fine), together with a link to an auxiliary menu which is not Java-based and works, but is less cool. The latter one is the one I implemented on the homepage ([here](http://www.uni-bayreuth.de/departments/zivilrecht8/) , if you’re interested in German civil law), simply because it works, but I’d be glad to have the Javascript one back working.

I made a number of attempts to correct this by copying and modifying the source code of the working menu of the other chair, and I came up with [this site](http://www.uni-bayreuth.de/departments/zivilrecht8/menu1_alt.htm), which has the desired menu and submenu structure, but it’s not clickable - nothing happens when you click it. I suspect it has something to do with the “menu\_def.js” file which is linked to in the header of the menu file, but I never modified that one, and when I opened it it didn’t seem to me as if this site needed to be adapted to the menu structure of the menu site. I guess it simply provides source information for the langauge, the taylor-made adaptation to your own site happens entirely on the menu site itself. Nonetheless, it doesn’t work, although I got a copy of the menu\_def.js file from the other chair.

I’m pretty much confused because I can’t explain where the mistake is. I’d be happy and grateful if any dopers were kind enough to take a few minutes to look at the codes and dare a guess on what might be wrong.

---

<div class="post-metadata">

### Author: ![slortar](https://avatars.discourse-cdn.com/v4/letter/s/6bbea6/32.png) [@slortar](https://boards.straightdope.com/u/slortar)
#### Post date: [April 20, 2007, 11:57am UTC](https://boards.straightdope.com/t/problem-with-a-javascript-website-menu/400913/2 "2007-04-20T11:57:59Z")

</div>

Personally, since I hate pouring through other peoples’ code, I’d just go with something simpler like [Son of Suckerfish](http://www.htmldog.com/articles/suckerfish/dropdowns/), but that’s mostly because I’m really, really lazy. 😉

---

<div class="post-metadata">

### Author: ![ZipperJJ](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/zipperjj/32/211_2.png) [@ZipperJJ](https://boards.straightdope.com/u/ZipperJJ)
#### Post date: [April 20, 2007, 12:27pm UTC](https://boards.straightdope.com/t/problem-with-a-javascript-website-menu/400913/3 "2007-04-20T12:27:21Z")

</div>

Which of those links is supposed to have a working menu with items that drop down? I’m using Firefox and none of those pages has a dropdown menu…

But, anyway, your problem is that one of your items has a ’ in it. Int’l Aspects of IP Law. You can’t have that within other single quotes… ‘Int’l Aspects of IP Law’ … See how it would confuse the browser as to where the beginning and the end of the item is?

Anyway, change it to ‘Int’l Aspects of IP Law’

But I think you need to implement a new menu. This one was made in 2001 and doesn’t seem to support Firefox.

---

<div class="post-metadata">

### Author: ![si\_blakely](https://avatars.discourse-cdn.com/v4/letter/s/d9b06d/32.png) [@si\_blakely](https://boards.straightdope.com/u/si_blakely)
#### Post date: [April 20, 2007, 12:45pm UTC](https://boards.straightdope.com/t/problem-with-a-javascript-website-menu/400913/4 "2007-04-20T12:45:38Z")

</div>

[QUOTE=slortar]  
Personally, since I hate pouring through other peoples’ code, I’d just go with something simpler like [Son of Suckerfish](http://www.htmldog.com/articles/suckerfish/dropdowns/), but that’s mostly because I’m really, really lazy. 😉  
[/QUOTE]  
I lost a day trying to get _Suckerfish_ working on a Joomla website. It looked really good, until you refreshed the page and my horizontal menu turned into a vertical one ☹

I gave up.

Si

---

<div class="post-metadata">

### Author: ![slortar](https://avatars.discourse-cdn.com/v4/letter/s/6bbea6/32.png) [@slortar](https://boards.straightdope.com/u/slortar)
#### Post date: [April 20, 2007, 1:04pm UTC](https://boards.straightdope.com/t/problem-with-a-javascript-website-menu/400913/5 "2007-04-20T13:04:53Z")

</div>

[QUOTE=si\_blakely]  
I lost a day trying to get _Suckerfish_ working on a Joomla website. It looked really good, until you refreshed the page and my horizontal menu turned into a vertical one ☹

I gave up.

Si  
[/QUOTE]

Yeah, the css is a bit touchy. On a current project I spent an hour and a half trying to figure out why IE 7 started chugging on a two level submenu but Firefox was fine. Turned out that IE **hates** having an li defined as “100%” of its parent–you have to specify the width exactly.

It’s still the most straightforward I’ve seen so far. It’s also pretty compatible and degrades **beautifully** on browsers that don’t support css–basically just turns into a neat list of site links.

---

<div class="post-metadata">

### Author: ![si\_blakely](https://avatars.discourse-cdn.com/v4/letter/s/d9b06d/32.png) [@si\_blakely](https://boards.straightdope.com/u/si_blakely)
#### Post date: [April 20, 2007, 5:49pm UTC](https://boards.straightdope.com/t/problem-with-a-javascript-website-menu/400913/6 "2007-04-20T17:49:52Z")

</div>

[QUOTE=slortar]  
Yeah, the css is a bit touchy. On a current project I spent an hour and a half trying to figure out why IE 7 started chugging on a two level submenu but Firefox was fine. Turned out that IE **hates** having an li defined as “100%” of its parent–you have to specify the width exactly.

It’s still the most straightforward I’ve seen so far. It’s also pretty compatible and degrades **beautifully** on browsers that don’t support css–basically just turns into a neat list of site links.  
[/QUOTE]  
Actually, it was FF giving me grief. A CTRL-R (refresh CSS) was ok, it was F5 (refresh HTML) that screwed up.

IE was fine, but I don’t use IE and I didn’t want to risk customers having a problem (this is for our small business).

Si

---

<div class="post-metadata">

### Author: ![Schnitte](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/schnitte/32/9033_2.png) [@Schnitte](https://boards.straightdope.com/u/Schnitte)
#### Post date: [April 21, 2007, 10:27am UTC](https://boards.straightdope.com/t/problem-with-a-javascript-website-menu/400913/7 "2007-04-21T10:27:02Z")

</div>

[QUOTE=ZipperJJ]  
Which of those links is supposed to have a working menu with items that drop down? I’m using Firefox and none of those pages has a dropdown menu…

[/QUOTE]

If you load the menu frame separately, then you’re right, but if you load the entire website with its three pages ([example](http://www.uni-bayreuth.de/departments/rw/lehrstuehle/oer1/), then the dropdown menu will appear when the cursor hovers over one of the top items, but only if you’ve already clicked any of the items in the top menu (at least that’s how it works with my machine, and I’m using Firefox too).

But more importantly, you’re right about the problem being the apostrophe in _Int’l Aspects of IP Law_. I wasn’t aware that this would confuse the browser due to the apostrophe’s meaning in the syntax of the script. Thank you so much, and thanks to verybody else for their help!

---

<div class="post-metadata">

### Author: ![79Eric](https://avatars.discourse-cdn.com/v4/letter/7/ecccb3/32.png) [@79Eric](https://boards.straightdope.com/u/79Eric)
#### Post date: [April 21, 2007, 7:36pm UTC](https://boards.straightdope.com/t/problem-with-a-javascript-website-menu/400913/8 "2007-04-21T19:36:15Z")

</div>

Try these sites

[http://dynamicdrive.com/](http://dynamicdrive.com/)

or

> **[JavaScript Kit- Your comprehensive JavaScript, DHTML, CSS, and Ajax stop](http://javascriptkit.com/)**
>
> Your comprehensive JavaScript, DHTML, CSS, and Ajax stop

They have message boards and free scripts the rock.
