PDA

View Full Version : Help with a Javascript dropdown?



lethe
02-01-2011, 10:54 PM
Hi all! I'm new and, well, I don't know a whole lot about javascript, honestly. I'm much more of an artistic design person than I am a coder.

That said, I recently made a dropdown menu using an old version of Fireworks, but I've been having trouble getting it working on my site. The menu displays alright, but the dropdown does not appear right below it...instead, it's off and to the right somewhere. For the life of me, and with my limited knowledge, I cannot figure out how to fix it.

The menu in question is the 'store' button on the following webpage- http://rlfcomic.com/test2.php#

Note how the dropdown just seems to float at an arbitrary spot. Any ideas on what I'm doing wrong?

oVTech
02-01-2011, 11:33 PM
Well one obvious problem, I think...
The div tag that contains the hidden items is located above the link that triggers them to display. Usually you would have the link that acts as a trigger, and then below the link you would have the hidden container that contains your items. Also you should play around with the left & right properties in the css.

Please do not use this kind of javascript code. All those programs produce very unreliable and old code.
this line: <script language="JavaScript"> should be changed to this: <script type="text/javascript">
Here is the copyright notice for your JS file. (look at the dates):


/**
* mm_menu 20MAR2002 Version 6.0
* Andy Finnell, March 2002
* Copyright (c) 2000-2002 Macromedia, Inc.
*
* based on menu.js
* by gary smith, July 1997
* Copyright (c) 1997-1999 Netscape Communications Corp.
*
* Netscape grants you a royalty free license to use or modify this
* software provided that this copyright notice appears on all copies.
* This software is provided "AS IS," without a warranty of any kind.
*/



You have about 764 lines of code just for that menu! You should get rid of that kind of code immediately! Start looking for a new menu. You do not even need javascript for a simple drop-down menu. CSS menus will accomplish the same thing and will always work no matter if javascript is off or on.

I hope this helps!

lethe
02-01-2011, 11:52 PM
Yeah, I didn't actually code it myself...Fireworks did all the work. Hadn't thought of using CSS...may look into that. It's just that it was really easy to make in Fireworks, but kind of a pain to implement.

Edit: FYI, that really fixed it! Whew!