473,396 Members | 1,852 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,396 software developers and data experts.

Layers issue in Netscape 4.x - tabs question

Can anyone help me adjust this code so that it works in Netscape 4.x?

I have am developing a website for a restaurant and the menu page has
menus for lunch and dinner. Two images work as tabs, so that when you
click on the lunch menu, only that menu is visible, and likewise, when
you click on the dinner tab, only the dinner menu is visible.

This code works like a charm on IE 5.5, but I don't know how to get a
workable solution on Netscape. I suspect it's not so hard, but I need
a little help.

Thanks!!

******************************************
<script language="javascript" type="text/javascript">
var tabVisible = "tab1"

function showTab(newTab) {
newButton="b"+newTab;
oldButton="b"+tabVisible.substr(3);
show(oldButton,oldButton+".gif");
show(newButton,newButton+"_over.gif");
newTab="tab"+newTab;
document.getElementById(tabVisible).style.visibili ty = "hidden";
document.getElementById(newTab).style.visibility = "visible";
tabVisible = newTab;
}

function newImage(arg) {if (document.images) {rslt = new Image();
rslt.src = arg; return rslt;}}

var preloadFlag = false;

function preloadImages() {if (document.images) {
b1sel = newImage("images/bt_menu_din.gif");
b2sel = newImage("images/bt_menu_lun.gif");

b1off = newImage("images/b1.gif");
preloadFlag = true;}}

function show(name,src)
{if (document.images && (preloadFlag == true))
document.images[name].src = "images/" + src;}

</script>
Jul 23 '05 #1
3 1214
Lee
Jeannie said:

Can anyone help me adjust this code so that it works in Netscape 4.x?

I have am developing a website for a restaurant and the menu page has
menus for lunch and dinner. Two images work as tabs, so that when you
click on the lunch menu, only that menu is visible, and likewise, when
you click on the dinner tab, only the dinner menu is visible.

This code works like a charm on IE 5.5, but I don't know how to get a
workable solution on Netscape. I suspect it's not so hard, but I need
a little help.

Thanks!!

******************************************
<script language="javascript" type="text/javascript">
var tabVisible = "tab1"

function showTab(newTab) {
newButton="b"+newTab;
oldButton="b"+tabVisible.substr(3);
show(oldButton,oldButton+".gif");
show(newButton,newButton+"_over.gif");
newTab="tab"+newTab;
document.getElementById(tabVisible).style.visibil ity = "hidden";
document.getElementById(newTab).style.visibilit y = "visible";
tabVisible = newTab;
}

function newImage(arg) {if (document.images) {rslt = new Image();
rslt.src = arg; return rslt;}}

var preloadFlag = false;

function preloadImages() {if (document.images) {
b1sel = newImage("images/bt_menu_din.gif");
b2sel = newImage("images/bt_menu_lun.gif");

b1off = newImage("images/b1.gif");
preloadFlag = true;}}

function show(name,src)
{if (document.images && (preloadFlag == true))
document.images[name].src = "images/" + src;}

</script>

The change to your Javascript code is to rewrite showTab()
as below. However, it still may not work, depending on
whether or not Netscape 4 sees not your page elements as
Layers.
function showTab(newTab) {
newButton="b"+newTab;
oldButton="b"+tabVisible.substr(3);
show(oldButton,oldButton+".gif");
show(newButton,newButton+"_over.gif");
newTab="tab"+newTab;
if(document.getElementById){
document.getElementById(tabVisible).style.visibili ty = "hidden";
document.getElementById(newTab).style.visibility = "visible";
}else if(document.layers){
document.layers[tabVisible].visibility = "hidden";
document.layers[newTab].visibility = "visible";
}
tabVisible = newTab;
}

Jul 23 '05 #2
Thanks - I gave it a shot, but the menu tabs end up on the top of the
page, but the description of the menu items aren't visible. Not sure
what the fix would be, but thanks for your input!

Lee <RE**************@cox.net> wrote in message news:<c5********@drn.newsguy.com>...
Jeannie said:

Can anyone help me adjust this code so that it works in Netscape 4.x?

I have am developing a website for a restaurant and the menu page has
menus for lunch and dinner. Two images work as tabs, so that when you
click on the lunch menu, only that menu is visible, and likewise, when
you click on the dinner tab, only the dinner menu is visible.

This code works like a charm on IE 5.5, but I don't know how to get a
workable solution on Netscape. I suspect it's not so hard, but I need
a little help.

Thanks!!

******************************************
<script language="javascript" type="text/javascript">
var tabVisible = "tab1"

function showTab(newTab) {
newButton="b"+newTab;
oldButton="b"+tabVisible.substr(3);
show(oldButton,oldButton+".gif");
show(newButton,newButton+"_over.gif");
newTab="tab"+newTab;
document.getElementById(tabVisible).style.visibil ity = "hidden";
document.getElementById(newTab).style.visibilit y = "visible";
tabVisible = newTab;
}

function newImage(arg) {if (document.images) {rslt = new Image();
rslt.src = arg; return rslt;}}

var preloadFlag = false;

function preloadImages() {if (document.images) {
b1sel = newImage("images/bt_menu_din.gif");
b2sel = newImage("images/bt_menu_lun.gif");

b1off = newImage("images/b1.gif");
preloadFlag = true;}}

function show(name,src)
{if (document.images && (preloadFlag == true))
document.images[name].src = "images/" + src;}

</script>

The change to your Javascript code is to rewrite showTab()
as below. However, it still may not work, depending on
whether or not Netscape 4 sees not your page elements as
Layers.
function showTab(newTab) {
newButton="b"+newTab;
oldButton="b"+tabVisible.substr(3);
show(oldButton,oldButton+".gif");
show(newButton,newButton+"_over.gif");
newTab="tab"+newTab;
if(document.getElementById){
document.getElementById(tabVisible).style.visibili ty = "hidden";
document.getElementById(newTab).style.visibility = "visible";
}else if(document.layers){
document.layers[tabVisible].visibility = "hidden";
document.layers[newTab].visibility = "visible";
}
tabVisible = newTab;
}

Jul 23 '05 #3
I am still in need of a solution, so if anyone knows how to make this
tabbed script work for IE4+, NS4+, NS6+, please drop me a line.
Thanks!!

bi*******@aol.com (Jeannie) wrote in message news:<51**************************@posting.google. com>...
Thanks - I gave it a shot, but the menu tabs end up on the top of the
page, but the description of the menu items aren't visible. Not sure
what the fix would be, but thanks for your input!

Lee <RE**************@cox.net> wrote in message news:<c5********@drn.newsguy.com>...
Jeannie said:

Can anyone help me adjust this code so that it works in Netscape 4.x?

I have am developing a website for a restaurant and the menu page has
menus for lunch and dinner. Two images work as tabs, so that when you
click on the lunch menu, only that menu is visible, and likewise, when
you click on the dinner tab, only the dinner menu is visible.

This code works like a charm on IE 5.5, but I don't know how to get a
workable solution on Netscape. I suspect it's not so hard, but I need
a little help.

Thanks!!

******************************************
<script language="javascript" type="text/javascript">
var tabVisible = "tab1"

function showTab(newTab) {
newButton="b"+newTab;
oldButton="b"+tabVisible.substr(3);
show(oldButton,oldButton+".gif");
show(newButton,newButton+"_over.gif");
newTab="tab"+newTab;
document.getElementById(tabVisible).style.visibil ity = "hidden";
document.getElementById(newTab).style.visibilit y = "visible";
tabVisible = newTab;
}

function newImage(arg) {if (document.images) {rslt = new Image();
rslt.src = arg; return rslt;}}

var preloadFlag = false;

function preloadImages() {if (document.images) {
b1sel = newImage("images/bt_menu_din.gif");
b2sel = newImage("images/bt_menu_lun.gif");

b1off = newImage("images/b1.gif");
preloadFlag = true;}}

function show(name,src)
{if (document.images && (preloadFlag == true))
document.images[name].src = "images/" + src;}

</script>

The change to your Javascript code is to rewrite showTab()
as below. However, it still may not work, depending on
whether or not Netscape 4 sees not your page elements as
Layers.
function showTab(newTab) {
newButton="b"+newTab;
oldButton="b"+tabVisible.substr(3);
show(oldButton,oldButton+".gif");
show(newButton,newButton+"_over.gif");
newTab="tab"+newTab;
if(document.getElementById){
document.getElementById(tabVisible).style.visibili ty = "hidden";
document.getElementById(newTab).style.visibility = "visible";
}else if(document.layers){
document.layers[tabVisible].visibility = "hidden";
document.layers[newTab].visibility = "visible";
}

tabVisible = newTab;
}

Jul 23 '05 #4

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

Similar topics

1
by: Lizzy | last post by:
I have an internet application which has a progress bar show whenever the customer is requesting data from the server. This progress bar is coded to work in both Netscape 4.75 and above and IE 5.0...
1
by: Chris Leonard | last post by:
Hi. Can anyone help me please. If the syntax for IE is: document.getElementById(layerID) What if I want to use layers ? document.layers ?????????
6
by: David List | last post by:
I'm having a problem using different properties of the document object in the example javascripts in my textbook with browsers that identify themselves as using the Mozilla engine. One example of...
2
by: Catherine Lynn Wood | last post by:
I need to know how to overlap DIV content within 'relative' associated rendering. I am building div layers in the middle of a page and when I set positioning to absolute in the CSS, it references...
3
by: Crimefighter | last post by:
I'm not a javascript guy, but the use of this banner rotator script has given me fits. I know a few causes of the problem thus far, one being the layer tags aren't supported under Netscape 7.1...
4
by: PsychoCrow | last post by:
Hello everybody, I looked for my problem googling, but I found always similar answers about layer visualization. I expose my problem, I have tre layers: LAYER1 LAYER2 LAYER3 and I need to...
10
by: InvisibleMan | last post by:
Hi, Thanks for any help in advance... Okay, I have the JS listed below that calls for the display of the (DIV) tag... cookie function not included, as don't feel its necessary but you'll get the...
4
by: ashkaan57 | last post by:
Hi, I am using the following code to show/hide part of an html page. It works in Netscape and Firefox but dies in IE: "Error: document.layers is null or not an object" <style> ..noshow {...
2
by: yawnmoth | last post by:
As I understand it, document.layers only works in Netscape 4+ (ie. it doesn't work in any version of Internet Explorer), while document.all only works in Internet Explorer 4+ (ie. it doesn't work...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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,...

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.