# JavaScript gurus: please help me with my menus

**URL:** https://boards.straightdope.com/t/javascript-gurus-please-help-me-with-my-menus/461197
**Category:** Factual Questions
**Created:** [August 25, 2008, 2:44pm UTC](https://boards.straightdope.com/t/javascript-gurus-please-help-me-with-my-menus/461197 "2008-08-25T14:44:18Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![Agent\_Foxtrot](https://avatars.discourse-cdn.com/v4/letter/a/9fc29f/32.png) [@Agent\_Foxtrot](https://boards.straightdope.com/u/Agent_Foxtrot)
#### Post date: [August 25, 2008, 2:44pm UTC](https://boards.straightdope.com/t/javascript-gurus-please-help-me-with-my-menus/461197/1 "2008-08-25T14:44:18Z")

</div>

At my job, we’re rolling out a new website to provide information and access to my hospital’s plethora of patient care applications. I was tasked with creating buttons that open into menus. Easy enough, especially since I used Adobe Fireworks and Dreamweaver. The menus look great in Firefox (no surprise), but in Internet Explorer, a grey border appears on the side. I’ve created screenshots to show you what I mean, viewable [here](http://agent.foxtrot.googlepages.com/JSButtons.jpg). If you need my code, please reply and I’ll PM it to you, since it’s quite a few lines.

Thanks for any and all help.

---

<div class="post-metadata">

### Author: ![pingnak](https://avatars.discourse-cdn.com/v4/letter/p/94ad74/32.png) [@pingnak](https://boards.straightdope.com/u/pingnak)
#### Post date: [August 25, 2008, 3:05pm UTC](https://boards.straightdope.com/t/javascript-gurus-please-help-me-with-my-menus/461197/2 "2008-08-25T15:05:20Z")

</div>

Seems to me there are about a thousand web sites that have menus like those that don’t break. Just grab the menus off one of those and see what they do differently.

There are lots of down menu samples, too.  
[http://www.google.com/search?q=javascript+drop+down+menus](http://www.google.com/search?q=javascript+drop+down+menus)

Microsoft does things like this routinely. Makes things ‘break’ for competing products, or more precisely (as they claim) they ‘only test with Microsoft products’. If you used Microsoft’s clone of Dreamweaver, I’m sure it would work for IE and break in other ways in Firefox. Not much help as you simply go to 20% broken from 80% broken. It’s still broken.

Don’t neglect to report the bug to Adobe.

---

<div class="post-metadata">

### Author: ![Agent\_Foxtrot](https://avatars.discourse-cdn.com/v4/letter/a/9fc29f/32.png) [@Agent\_Foxtrot](https://boards.straightdope.com/u/Agent_Foxtrot)
#### Post date: [August 25, 2008, 3:12pm UTC](https://boards.straightdope.com/t/javascript-gurus-please-help-me-with-my-menus/461197/3 "2008-08-25T15:12:35Z")

</div>

But if JavaScript was created by Microsoft, then why would the menus be buggy in MSIE? Shouldn’t it be buggy in Firefox? It shouldn’t matter to the parser that the JavaScript code was created using Adobe, right?

---

<div class="post-metadata">

### Author: ![Rysto](https://avatars.discourse-cdn.com/v4/letter/r/ecccb3/32.png) [@Rysto](https://boards.straightdope.com/u/Rysto)
#### Post date: [August 25, 2008, 3:16pm UTC](https://boards.straightdope.com/t/javascript-gurus-please-help-me-with-my-menus/461197/4 "2008-08-25T15:16:39Z")

</div>

JavaScript wasn’t created by Microsoft.

---

<div class="post-metadata">

### Author: ![friedo](https://avatars.discourse-cdn.com/v4/letter/f/8edcca/32.png) [@friedo](https://boards.straightdope.com/u/friedo)
#### Post date: [August 25, 2008, 3:22pm UTC](https://boards.straightdope.com/t/javascript-gurus-please-help-me-with-my-menus/461197/5 "2008-08-25T15:22:28Z")

</div>

[QUOTE=Agent Foxtrot]  
But if JavaScript was created by Microsoft, then why would the menus be buggy in MSIE? Shouldn’t it be buggy in Firefox? It shouldn’t matter to the parser that the JavaScript code was created using Adobe, right?  
[/QUOTE]

JavaScript was created by Netscape, and standardized by ECMA. The MSIE version, called JScript, actually has some subtle incompatibilities with the standard.

Nonetheless, problems with doing things like dynamic menus and whatnot usually come down to differences in the DOM models between browsers, or using non-standard JS methods for DOM manipulation. There’s no guarantee that an Adobe product will output standards-compliant JavaScript – you’ll almost certainly have to tweak it by hand.

---

<div class="post-metadata">

### Author: ![Agent\_Foxtrot](https://avatars.discourse-cdn.com/v4/letter/a/9fc29f/32.png) [@Agent\_Foxtrot](https://boards.straightdope.com/u/Agent_Foxtrot)
#### Post date: [August 25, 2008, 3:39pm UTC](https://boards.straightdope.com/t/javascript-gurus-please-help-me-with-my-menus/461197/6 "2008-08-25T15:39:11Z")

</div>

Ah, my mistake. I thought JavaScript was created as Microsoft’s answer to Sun’s Java. **friedo** mentioned tweaking the code, which is what I want to do, but I’m no JavaScript expert. And since this website will be a reflection of my hospital, it needs to look good for all browsers. Can I send the code to someone so they can tell me how to tweak it, or is that asking too much?

---

<div class="post-metadata">

### Author: ![friedo](https://avatars.discourse-cdn.com/v4/letter/f/8edcca/32.png) [@friedo](https://boards.straightdope.com/u/friedo)
#### Post date: [August 25, 2008, 3:47pm UTC](https://boards.straightdope.com/t/javascript-gurus-please-help-me-with-my-menus/461197/7 "2008-08-25T15:47:45Z")

</div>

[QUOTE=Agent Foxtrot]  
Ah, my mistake. I thought JavaScript was created as Microsoft’s answer to Sun’s Java.  
[/QUOTE]

Noooooooo. Java has _nothing whatsoever_ to do with JavaScript. They are completely unrelated technologies with almost nothing in common, except for their common syntactic ancestors.

The Netscape product (which they originally called LiveScript) stupdily changed their name to capitalize on Sun’s marketing efforts, back when they thought that sticking Java applets in web browsers was a good idea. Confusion reigns to this day.

As for your menu problem, I strongly recommend **pingnak** ’s suggestion of adapting one of the myriad freeware JS menu libraries. Usually, those are set up so you just have to create some lists and the JS does everything automatically, without the need to tweak it.

One of the great sites for this kind of thing is [A List Apart](http://www.alistapart.com/), and [here](http://www.alistapart.com/articles/horizdropdowns/) is one example of how to create cross-platform menus using a small bit of JavaScript and CSS.

---

<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: [August 25, 2008, 4:31pm UTC](https://boards.straightdope.com/t/javascript-gurus-please-help-me-with-my-menus/461197/8 "2008-08-25T16:31:18Z")

</div>

I am just guessing but you probably need to widen the menu items in CSS. Make the width of the menu items 100%. The black is probably the menu shell div and the lighter color is the actual items.

There’s a difference in the way FE and IE interpret padding and widths.

---

<div class="post-metadata">

### Author: ![Duckster](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/duckster/32/1244_2.png) [@Duckster](https://boards.straightdope.com/u/Duckster)
#### Post date: [August 25, 2008, 5:50pm UTC](https://boards.straightdope.com/t/javascript-gurus-please-help-me-with-my-menus/461197/9 "2008-08-25T17:50:27Z")

</div>

Does your menu degrade gracefully when a web browser’s Javascript is disabled?

My point in asking is a hospital web site has a high profile when it comes to accessibility. While the federal government’s accessibility requirements (Section 508) do not apply to web sites not maintained with federal tax dollars, be aware your state have have its own version of Section 508 and it may apply to your hospital web site, especially if it’s a public hospital with any kind of taxpayer support. At the same time, the site may be subject to ADA requirements (the [target.com](http://target.com) accessibility case is the current high profile issue).

There are several menu designs that work with minimal to no Javascript involvement. Some all CSS design work quite well, with a defined hack for IE.
