473,322 Members | 1,473 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Javascript and Menus using styles

Hi,

Does anybody know how to make this piece of javascript (below) work in
netscape? This only works in IE (I have only tried 5.5 and 6). I would
like to know how to make this work exactly the same way in Netscape.

Thanks very much...
<html>
<head>
<script language="JavaScript">
function doit(pTable){
if (document.all[pTable].style.display == "none"){
document.all[pTable].style.display = "block";
}
else{
document.all[pTable].style.display = "none";
}
}
</script>
</head>

<body>
<div class='mainmenu'><a href="#" onclick="doit('Group1');return
false;">Menu One</a></div>
<div style="display:none;" id="Group1" name="Group1">
<a href="#">Item 1.1</a><br />
<a href="#">Item 1.2</a><br />
<a href="#">Item 1.3</a>
</div>
<br />
<div class='mainmenu'><a href="#" onclick="doit('Group2');return
false;">Menu Two</a></div>
<div style="display:none;" id="Group2" name="Group2">
<a href="#">Item 2.1</a><br />
<a href="#">Item 2.2</a><br />
<a href="#">Item 2.3</a>
</div>
</body>
</html>


Jul 20 '05 #1
1 1440
"Disco" <di**********@yahoo.com> wrote in news:86h5b.1025$U74.61328
@news.optus.net.au:
Hi,

Does anybody know how to make this piece of javascript (below) work in
netscape? This only works in IE (I have only tried 5.5 and 6). I would
like to know how to make this work exactly the same way in Netscape.

Thanks very much...

use document.getElementById(pTable) instead of document.all[pTable]

document.all is microsoft specific and document.getElementById is the
standards way supported by modern browsers. IE4, I believe, is the only
browser that supports document.all but not document.getElementById.


--
In theory there is no difference between theory and practice. In practice
there is. - YB
Jul 20 '05 #2

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

Similar topics

1
by: Disco | last post by:
Hi, Does anybody know how to make this piece of javascript (below) work in netscape? This only works in IE (I have only tried 5.5 and 6). I would like to know how to make this work exactly the...
2
by: Pat Scott | last post by:
I am looking for a general purpose javascript snippet that enables me to <div> or <span> HTML to make portions of the form be hidden and then appear. The form contains about 12 sections and some...
2
by: Jackson Yap | last post by:
can someone kind enough to help me look at the attached html and js file? Why is it that the javascript menu could not work at www.apchosting.net but could work at...
15
by: binnyva | last post by:
Hello Everyone, I have just compleated a JavaScript tutorial and publishing the draft(or the beta version, as I like to call it) for review. This is not open to public yet. The Tutorial is...
21
by: petermichaux | last post by:
Hi, I've been asking questions about library design over the last week and would like to get feedback on my overall idea for a JavaScript GUI library. I need a nice GUI library so there is a...
11
by: Kent Feiler | last post by:
One thing I like about frames is that they're a good place to stow Javascript. Javascript that I'd like to be around while the visible content of the screen changes goes in the frame declaration...
12
by: tim | last post by:
I am using foldoutmenu 3 and am having problems with viewing my menus in firefox. On my sub3 menus i have more than one line of text in some places. firefox does not recognise that there is more...
9
by: Mahernoz | last post by:
Hello Friends, The JavaScript File exmplmenu_var.js contains the code... (for the sake of brevity i am showing only that code which needs to be changed) I am actually developing a menu using...
2
by: davidson1 | last post by:
Hai friends..for menu to use in my website..i found in one website....pl look below website.... http://www.dynamicdrive.com/dynamicindex1/omnislide/index.htm i downloaded 2 files.... ...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.