SageFix. LetsFix!  
Current Location : Home > Web Development > JavaScript > javasript and Netscape 6.2.3 Share/Save/Bookmark    

Main Menu
SageFix - Let's Fix

Board Categories
    Web Site Designing
- Graphics
    Web Development
- .NET
- Classic ASP
- JavaScript
- PHP
    WebSite Management
- Promotion Techniques
- Search Engine Optimization
    Databases
- MySQL

Tutorials

Database Connection Strings

  Contact Us


 1 - 6 of 6 [Total 1 Pages]  
javasript and Netscape 6.2.3      Jul 27, 2002, 10:27 1
  
I use javascript to highlight the current page on the menu bar and also to drop down a submenu when the user clicks on a menu item. This works fine in Internet Explorer 6.0 but not in Netscape 6.2.3, and I do not understand why! The code can be viewed at www.candlewoodcc.com. For the rest of the site I use an include file with the menu, but the code is the same.

Any suggestions?

 
      Jul 27, 2002, 11:19 2
  
Sorry - not really in the mood for prancing off round the internet. Can you post the code here please?

I guess you're using window.focus() to highlight the page
on the start bar - right?

Flawless

 
      Jul 27, 2002, 11:41 3
  
You appear to be using the proprietary Microsoft Document.all DOM to access the elements.

This will only work in IE, and in any other browser that tries to play catch-up with microsoft by implementing it.

Try replacing :
sub_course.style.display="none";
with
document.getElementById("sub_course").style.display="none";

That's the W3C DOM, which should work in IE, Mozilla (and its siblings, including N6), and maybe a few others I don't know about.

 
      Jul 27, 2002, 12:14 4
  
Thanks for replying and here's more info. I don't use window.focus() to highlight the menu item, but rather javascript to load a different image that has the same text, but different color. To control both the highlight and the submenu opening I use <DIV> in the HTML code. I don't understand why it works in Internet Explorer 6.0 but not in Netscape 6.2.3. (Yes, I have checked the 'javascript enable' option in Netscape and when I go to other webpages, their javascript executes.)

Here are the 2 javascript functions:
<SCRIPT language="JavaScript">
function highlight_menu_title(id) {
if (id==0) {
home_regular.style.display="none";
home_highlight.style.display="block";
}
else if (id==1) {
course_regular.style.display="none";
course_highlight.style.display="block";
}
else if (id==2) {
memberships_regular.style.display="none";
memberships_highlight.style.display="block";
}
//etc...
}

function show_sub_menu(num) {
if (num==0) { //Home
sub_course.style.display="none";
sub_membership.style.display="none";
sub_tournaments.style.display="none";
sub_social.style.display="none";
sub_newsletter.style.display="none";
sub_banquet.style.display="none";
sub_dining.style.display="none";
sub_profiles.style.display="none";
sub_contactus.style.display="none";
}
if (num==1) { //The Course
sub_course.style.display="block";
sub_membership.style.display="none";
sub_tournaments.style.display="none";
sub_social.style.display="none";
sub_newsletter.style.display="none";
sub_banquet.style.display="none";
sub_dining.style.display="none";
sub_profiles.style.display="none";
sub_contactus.style.display="none";
}
else if (num==2) { //Membership
sub_course.style.display="none";
sub_membership.style.display="block";
sub_tournaments.style.display="none";
sub_social.style.display="none";
sub_newsletter.style.display="none";
sub_banquet.style.display="none";
sub_dining.style.display="none";
sub_profiles.style.display="none";
sub_contactus.style.display="none";
}
//etc...
}
</SCRIPT>
Here is the HTML code:

<!-- MENU BAR -->
<TD width="175" valign="top" align="left">
<TABLE width="175" valign="top" align="left"
bgcolor="#D3DD8D" cellpadding="0" cellspacing="0">
<!-- HOME -->
<tr>
<td align="left">
<DIV id="home_regular" style="display:block;">
<a href="index.html">
<img src="images/home.gif" alt="Home page"
border="0" width="150" height="22"></a>
</DIV>
<DIV id="home_highlight" style="display:none;">
<img src="images/homehighlight.gif" alt="Home
page" border="0" width="150" height="22">
</DIV></td>
</tr>

<!-- THE COURSE -->
<tr>
<td align="left">
<DIV id="course_regular" style="display:block">
<a href="javascript:show_sub_menu('1');">
<img src="images/thecourse.gif" alt="Open submenu
for the course" border="0" width="150"
height="22"></a>
</DIV>
<DIV id="course_highlight" style="display:none">
<a href="javascript:show_sub_menu('1');">
<img src="images/thecoursehighlight.gif"
alt="The Course" border="0" width="150"
height="22"></a>
</DIV></td>
</tr>
<tr>
<td align="left">
<DIV id="sub_course" style="display:none">
<a href="coursedescription.shtml">
<img src="images/description.gif"
alt="Course Description" border="0"
width="150" height="15"></a>
<a href="scorecard.shtml">
<img src="images/scorecard.gif" alt="Scorecard"
border="0" width="150" height="15"></a>
</DIV>
</td>
</tr>
<!-- ETC... -->
</TABLE>

<!-- HIGHLIGHT THE COURSE AND SHOW SUBMENU -->
<SCRIPT language="Javascript">
highlight_menu_title('1');
show_sub_menu('1');
</SCRIPT>
</TD>

I'll be happy to answer any other questions.

 
      Jul 27, 2002, 12:36 5
  
Thanks a million, blufive, it works now!!!
I am fairly new at this and didn't realize I was using a proprietary Document.all DOM from Microsoft. I need to learn more about this!

 
      Jul 28, 2002, 05:40 6
  
getElementById works in NS6 and ie 5+

Flawless

 
 1 - 6 of 6 [Total 1 Pages]  









Subscribe to our mailing list
email


Current Location : Home > Web Development > JavaScript > javasript and Netscape 6.2.3 Share/Save/Bookmark    

Development problem? SageFix is completely free -- paid for by advertisers and donations. Click here to Contact Us If you have any query. Enjoy!
Request processed in 8.0E-5 seconds Home - Contact Us - Terms Of Service - Privacy Policy - Copyrights - Top
Advertisements do not imply our endorsement of that product or service.
Current server time now is 19-Mar-2010 12:14:40
Copyright © 2009 Sagefix Inc. All rights reserved.
Powered By SageFix