473,588 Members | 2,474 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

browser issue causing problem in dropdown feature

On the left side of the main webpage I have some menu options that
have a drop-down feature that is controlled with javascript. You click
on the main heading and the links for that section show up. Click on
it again and they disappear. This works great in IE6 but doesn't seem
to work in Netscape 7.

I have included the main javascript code below, along with a sample of
the Menu code. What (if anything) do I need to tweak to get this to
work under Netscape?
javascript code:
<script language=JScrip t>
document.onclic k = DropDownMenu;

function DropDownMenu() {
var LinkClicked, DivName, TargetDiv;

LinkClicked = window.event.sr cElement;
if (LinkClicked.cl assName == "Category") {
DivName = "Div_" + LinkClicked.id. substr(5,
LinkClicked.id. length);
TargetDiv = document.all(Di vName);
if (TargetDiv.styl e.display == "")
TargetDiv.style .display = "none";
else
TargetDiv.style .display = "";
} // if
} // DropDownMenu
</script>

Sample of Menu item:
<ul>
<li><b><a id=Link_Memoria m class=Category href=#>In
Memoriam</a></b></li>
<div id=Div_Memoriam style="display: none">
<ul>
<li><a href="memoriam/DickPollitz.htm ">Dick Pollitz</a></li>
</ul>
</div>
</ul>
Jul 20 '05 #1
1 1859
Whitney wrote:
On the left side of the main webpage I have some menu options that
have a drop-down feature that is controlled with javascript. You click
on the main heading and the links for that section show up. Click on
it again and they disappear. This works great in IE6 but doesn't seem
to work in Netscape 7.

I have included the main javascript code below, along with a sample of
the Menu code. What (if anything) do I need to tweak to get this to
work under Netscape?
javascript code:
<script language=JScrip t>
Netscape 7 doesn't support any language called "JScript". Use:

<script type="text/javascript">
document.onclic k = DropDownMenu;

function DropDownMenu() {
var LinkClicked, DivName, TargetDiv;

LinkClicked = window.event.sr cElement;
Netscape 7 doesn't have an Event object attached to the default window
object. The event is passed as the first parameter to the function. Nor
does Netscape 7 have a "srcElement " property of the event, it has a
"target" property:

function DropDownMenu(e) {
var LinkClicked, DivName, TargetDiv;

LinkClicked = e ? e.target : window.event.sr cElement;
if (LinkClicked.cl assName == "Category") {
DivName = "Div_" + LinkClicked.id. substr(5,
LinkClicked.id. length);
TargetDiv = document.all(Di vName);
Netscape 7 doesn't support document.all:

if (document.getEl ementById) { // NS6+, IE5.5+,Opera 7+
TargetDiv = document.getEle mentById(DivNam e);
} else if (document.all) { // IE4
TargetDiv = document.all(Di vName);
}
if (TargetDiv.styl e.display == "")
TargetDiv.style .display = "none";
else
TargetDiv.style .display = "";
} // if
} // DropDownMenu
</script>

Sample of Menu item:
<ul>
<li><b><a id=Link_Memoria m class=Category href=#>In
Memoriam</a></b></li>
<div id=Div_Memoriam style="display: none">
<ul>
<li><a href="memoriam/DickPollitz.htm ">Dick Pollitz</a></li>
</ul>
</div>
</ul>


With the changes indicated, I tested it in IE6SP1, Mozilla 1.5a and Opera
7.11 and it worked.

--
| Grant Wagner <gw*****@agrico reunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...ce/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 6/7 and Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
2847
by: Java script Dude | last post by:
To all Mozilla JS Guru's (IE dudes welcome), I have spent the last three years developing complex DHTML applications that must work in IE 5.5sp2+ but I use Mozilla 1.3+** to do all my development. I have build some cross browser debuggers so my users can send me verbose debug dumps. I have some success but have come to a roadblock with the basic underlying JavaScript models. The only way to get a complete stack in IE is to use the...
12
10146
by: Kepler | last post by:
How do you get the height of the client browser in IE? Both document.body.clientHeight and document.body.offsetHeight return the height of the document. If the page is long and there's a vertical scrollbar, you get the height of the entire document, screwing up any chance of centering a window in the browser using these values. Is there a way to get the height of the actual browser window and not the entire page height? Thanks.
17
2535
by: lawrence | last post by:
How is it possible that the question "How do I detect which browser the user has" is missing from this FAQ: http://www.faqts.com/knowledge_base/index.phtml/fid/125 and is only here on this with a link to old information that suggests use of "navigator": http://developer.irt.org/script/43.htm
11
2459
by: muraii | last post by:
Hi all, I've trolled through Google, a little of evolt, css-discuss archives, and sent the list a request, all to no avail. I consulted positioniseverything.net and quirksmode.org. The issue I have seems simple enough that I'd have turned it up on any of those sources, but, alas, that's not the case. So, please refer to
3
2239
by: Ben | last post by:
Hi, I'm sending out a session cookie. That is a cookie that has no expiration date. When I surf through the site, no problems, but if I close the browser and open it back up, the cookie is still there if other browser windows were open. Even if those windows didn't go to the site with the cookie or spawn from the browser that is visiting the site. This is causing a problem. People want to be able to close the browser to logout. How...
5
10280
by: Gil | last post by:
Is there a way to tell if a combbox is in dropdown mode. I tried and if statement combobox.dropdown = true but i get an error. dropwndown function doesnt store if its true or false what i am trying to do is make an autoscroll combobox. like you have on html textbox's, but this time you hit enter for a change to be made. i do this because i dont want to requery every time a single letter is inputed. it would be too slow. so i make them hit...
5
2424
by: Tom Anderson | last post by:
I am currently having an issue with an ASP.Net 1.1 Web page that does the following remotely but not locally. Click on a control Check for postback, if postback, handle the event, otherwise populate page with options. What is happening is that remotely the page is doing a double postback, then doing a post without data at all resulting in the event being fired twice, then redirecting to the incorrect option in a dropdown (going to...
16
2344
by: petermichaux | last post by:
Hi, Does anyone have a a cross-browser setOpacity function that does not use browser sniffing? I looked at the Yahoo! UI function and it detects IE by looking for window.ActiveXObject. I also looked at Scriptaculous and it uses navigator.userAgent. Thanks, Peter
18
2668
by: Marilyth | last post by:
I am using Windows XP and Access 2003. I have searched through my HUGE book & the questions here, and found some items that "might" help, but unsure still. I am still getting versed on Access. I know there are expressions, however the order and manner in which they need to be phrased is still a work in progress. I am looking for help creating some code/expressions. The database is summarized below: 1. The form is open for data entry to...
0
7929
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7862
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
7987
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8223
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6634
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5398
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3847
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3887
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2372
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.