Help answer threads with 0 replies.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 11-07-2003, 10:57 AM   #1
Registered: Mar 2003
Location: Massachusetts, USA
Distribution: RH 8, Solaris, Windoze eXPunged
Posts: 520

Rep: Reputation: 30
Any javascript experts here? NS alignment problem

Hi all,

I have asked this question in several other html/css/javascript specific forums throughout the web to no avail. Can LQ help with a non-LQ question?! I hope so! At I have found a JS drop-down menu I like and have implemented it (I got the script from Dynamic Drive). Unfortunately, I know very little about javascript. In IE and Opera, the page looks great and works perfectly. In NS7, there is a problem with the drop-down menus, which is this:

The 4 links towards the top (My Obnoxious Husband, My Beautiful Son, My Family, My Extended Family) are supposed to generate drop-down menus when clicked. This DOES happen, but in NS7, you'll notice that the drop-down menus pop up all the way in the top-left corner of the screen. Can anyone help me fix that so they pop up where they're supposed to (right below the link)? I'd appreciate it. You'll see it, but looking at the html, you'll notice that there actually 14 seperate JS files being called regarding this script, but the main one is menu2.js which is this:

var zindex=100
var ns4=document.layers
var ns6=document.getElementById&&!document.all
var ie4=document.all
var opr=navigator.userAgent.indexOf("Opera")

function dropit(e,whichone){
curmenuID=ns6? document.getElementById(whichone).id : eval(whichone).id
if (window.themenu&&!=curmenuID)
themenuStyle.visibility=ns4?"hide" : "hidden"

themenu=ns6? document.getElementById(whichone): eval(whichone)
themenuStyle=(ns6||ie4)? : themenu

themenuoffsetX=(ie4&&opr==-1)? document.body.scrollLeft : 0
themenuoffsetY=(ie4&&opr==-1)? document.body.scrollTop : 0

themenuStyle.left=ns6||ns4? e.pageX-e.layerX : themenuoffsetX+event.clientX-event.offsetX||ns4? e.pageY-e.layerY+19 : themenuoffsetY+event.clientY-event.offsetY+18

hiddenconst=(ns6||ie4)? "hidden" : "hide"
if (themenuStyle.visibility==hiddenconst){
themenuStyle.visibility=(ns6||ie4)? "visible" : "show"
return false

function hidemenu(){
if ((ie4||ns6)&&window.themenu)
else if (ns4)

if (ie4||ns6)

Everything else about this page works fine, it's just the lack of proper functionality in NS. Can anyone help me out? Thanks a million!


Last edited by WorldBuilder; 11-07-2003 at 10:59 AM.
Old 11-07-2003, 01:52 PM   #2
dave bean
Registered: Jun 2003
Location: UK
Distribution: Slackware 9.1
Posts: 136

Rep: Reputation: 15
Have u tried to view it independently of the CSS ? I had a simialar problem with a fireworks navbar i embedded into a CSS span. If the problem is CSS related then you will have to rereference the starting position of the menus. Is it CSS related ?
Old 11-07-2003, 03:20 PM   #3
Registered: Mar 2003
Location: Massachusetts, USA
Distribution: RH 8, Solaris, Windoze eXPunged
Posts: 520

Original Poster
Rep: Reputation: 30
I'm 99% certain that it's not css related. This javascript is not being called in a class of any kind. It has something to do with relative or absolute positioning ( I THINK) in this section of the html file:
<div id="dropmenu0" class="clsMenuTitle" style="position:absolute;left:0;top:0;background-color:#039;width:120px;visibility:hidden;border:0px;padding:0px">
<script type="text/javascript" src="drop0a.js"></script>
<script type="text/javascript" src="drop0b.js"></script>

<div id="dropmenu1" class="clsMenuTitle"
<script type="text/javascript" src="drop1a.js"></script>
<script type="text/javascript" src="drop1b.js"></script>

<div id="dropmenu2" class="clsMenuTitle" style="position:absolute;left:0;top:0;background-color:#039;width:120px;visibility:hidden;border:0px;padding:0px">
<script type="text/javascript" src="drop2a.js"></script>
<script type="text/javascript" src="drop2b.js"></script>

<div id="dropmenu3" class="clsMenuTitle" style="position:absolute;left:0;top:0;background-color:#039;width:120px;visibility:hidden;border:0px;padding:0px">
<script type="text/javascript" src="drop3a.js"></script>
<script type="text/javascript" src="drop3b.js"></script>
That MIGHT be where the problem is (so in a way it is a css problem), but I have fiddled with these settings to no avail. To be honest, I don't know where the problem is: the script, the style, the html... I just don't know.

Old 12-12-2003, 12:54 AM   #4
LQ Newbie
Registered: Dec 2003
Location: Chicago
Posts: 1

Rep: Reputation: 0
I am invoking dropit using the following code, and it positions correctly on both NS7 and Mozilla1.4. I left the

<div ... style="position:absolute;left:0;top:0; ...">
menu definitions just as you have it.

<span style="position:relative" onclick="dropit(event,'dm1');event.cancelBubble=true;return false">

<a style="text-decoration:none" onclick="if(ns4) return dropit(event,'document.dm1')" href="http://whatever">tagtext</a>

Old 12-12-2003, 08:46 AM   #5
Registered: Mar 2003
Location: Massachusetts, USA
Distribution: RH 8, Solaris, Windoze eXPunged
Posts: 520

Original Poster
Rep: Reputation: 30
Thanks guys,

I found yet another pre-made drop-down menu last week, implemented it, and completey rewrote the code. All's well now! Thanks!



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux: By Experts - For Experts Cinematography General 10 05-12-2005 03:14 AM
Problem Regarding Network in SuSE 9.2 Pro. HELP Please, Experts! ! ! bedi-beparwah Linux - Networking 8 03-30-2005 02:07 AM
Lexmark Z53 Alignment Problem sarboras Mandriva 1 10-26-2003 05:36 AM
Java/Javascript problem????? Jadewolf Linux - Software 2 10-25-2003 08:06 PM
Javascript in Linux problem? BajaNick Linux - Software 5 10-20-2003 01:41 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:08 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration