Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-21-2002, 07:31 PM   PM User | #1
bassleader
New Coder

 
Join Date: Jun 2002
Location: Caerdydd
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
bassleader is an unknown quantity at this point
Expanding/Collapsing Menus in NS6

Hi guys,

I've written an expanding and collapsing navigation menu for my website. I'm using <div>s for the submenus and changing the style.visibility and style.display properties to show and hide them. The problem I have is the different behaviour between browsers. It works OK in MSIE but in NS6 when you hide the submenu it leaves a huge gap where the menu was, rather than realigning the menu. You can see what I mean here. I think the problem could be something to do with Netscape's treatment of tables, but I'm not sure how to change it. If you have any suggestions I'd be very pleased to hear them.

Cheers.
bassleader is offline   Reply With Quote
Old 06-21-2002, 10:21 PM   PM User | #2
Roy Sinclair
Senior Coder

 
Join Date: Jun 2002
Location: Wichita
Posts: 3,880
Thanks: 0
Thanked 0 Times in 0 Posts
Roy Sinclair will become famous soon enough
I was going to try and help you but your browser detection code totally misses when I tried it with the Mozilla browser (Netscape 6+ is just a cheap knock-off). You need to refine your detection code to accept any Gecko based browser and not just Netscape branded versions.
Roy Sinclair is offline   Reply With Quote
Old 06-24-2002, 06:04 PM   PM User | #3
bassleader
New Coder

 
Join Date: Jun 2002
Location: Caerdydd
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
bassleader is an unknown quantity at this point
Thanks Roy, I have amended my browser detection script and downloaded Mozilla. The realignment problem doesn't occur in Mozilla, so should I assume that this is a problem with NS (I am using v6.1)? If you're still interested I'd really appreciate your thoughts.

BL
bassleader is offline   Reply With Quote
Old 06-24-2002, 06:30 PM   PM User | #4
jkd
Senior Coder

 
jkd's Avatar
 
Join Date: May 2002
Location: metro DC
Posts: 3,163
Thanks: 1
Thanked 18 Times in 18 Posts
jkd will become famous soon enough
NS6.1 is based on an older version of Mozilla, which means more bugs were still unfixed.

This is true for all version of NS, even NS7 PR, which is based on Moz 0.99 (?), and the current official release is Moz 1.0, and you can grab Moz 1.1 Alpha if you please too.
__________________
jasonkarldavis.com
jkd is offline   Reply With Quote
Old 06-24-2002, 09:32 PM   PM User | #5
Roy Sinclair
Senior Coder

 
Join Date: Jun 2002
Location: Wichita
Posts: 3,880
Thanks: 0
Thanked 0 Times in 0 Posts
Roy Sinclair will become famous soon enough
Quote:
Originally posted by bassleader
Thanks Roy, I have amended my browser detection script and downloaded Mozilla. The realignment problem doesn't occur in Mozilla, so should I assume that this is a problem with NS (I am using v6.1)? If you're still interested I'd really appreciate your thoughts.

BL
Take a look at the release notes for Mozilla, they may tell you about a positioning bug in earlier versions that they fixed which may give you a clue about what you can do to fix it in the Netscape 6x browsers. Netscape 7 should be based on Mozilla 1.0 so how long you'll need a fix really depends on how long it takes to get the majority of users to move away from those "beta browser as a released version" Netscape 6x browsers.
Roy Sinclair is offline   Reply With Quote
Old 06-24-2002, 11:50 PM   PM User | #6
Graeme Hackston
Regular Coder

 
Join Date: Jun 2002
Posts: 624
Thanks: 0
Thanked 0 Times in 0 Posts
Graeme Hackston is an unknown quantity at this point
This works in NN6.2.1 on Win98.

<html>
<head>
<title>Expand</title>
<script language="JavaScript" type="text/javascript">
<!-- Hide script from older browsers

function toggle(Sub) {
if (document.getElementById) {
thisMenu = document.getElementById(Sub).style
if (thisMenu.display == "block") {
thisMenu.display = "none"
}
else {
thisMenu.display = "block"
}
return false
}
else {
return true
}
}

// End hiding script -->
</script>

<style>
.Subs {display: none;}
</style>

</head>
<body>

<a href="page.html" onClick="return toggle('Sub1')">Heading 1</a><br>
<span class="Subs" ID="Sub1">
content
</span>
<a href="javascript:void(0);" onClick="return toggle('Sub2')">Heading 2</a><br>
<span class="Subs" ID="Sub2">
content
</span>
<a href="#" onClick="return toggle('Sub3')">Heading 3</a>
<span class="Subs" ID="Sub3">
content
</span>
</body>
</html>

</edit>I had an open tag<edit>

Last edited by Graeme Hackston; 06-24-2002 at 11:55 PM..
Graeme Hackston is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:35 AM.


Advertisement
Log in to turn off these ads.