• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

drop down menu not working in mozilla

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

DeathONator

Member
Joined
Nov 21, 2002
Location
Colorado, USA
I can't get it to work in mozilla. Is it because they changed how to detect the netscape browser when it went to mozilla? What am I missing? Help!

Code:
<HTML>
<HEAD>
<SCRIPT language="JavaScript1.2">

if (document.layers) {n=1;ie=0}
if (document.all) {n=0;ie=1}

 function init()
        {
        if (n) tab = document.menu1Div
        if (n) poptext = document.poptext1Div

        if (ie) tab = menu1Div.style
        if (ie) poptext = poptext1Div.style
        }


var tabShow=1;

 //Hide-Show Layer
 function hidepoptext()
 {
        if (tabShow == 0)
        {
                if (n) {
                poptext.visibility = "hide";
                tabShow = 1;
                return;
                         }
                if (ie) {
                poptext.visibility = "hidden";
                tabShow = 1;
                return;
                          }
        }

        if (tabShow == 1)
        {
                if (n) {
                poptext.visibility = "show";
                tabShow = 0;
                          }
                if (ie) {
                poptext.visibility = "visible";
                tabShow = 0;
                          }
         }
 }

</SCRIPT>

<STYLE>
<!--
        #menu1div
        {
        position: absolute;
        top: 150px;
        left: 50px;
        width: 87;
        height: 25;
        Padding: 0pt;
        Margin: 0pt;
	Font
        Font-family: Saturday Sans ICG, Tekton;
        Font-size: 14pt;
        Font-weight: Bold;
        Border-color: silver;
        Background-color: gray;
        z-index: 2;

        }

        #poptext1div
        {
        visibility: hide;
        visibility: hidden;
        position: absolute;
        width: 200px;
        top: 175px;
        left: 50px;
        Border: .01pt;
        Border-color: silver;
        Background-color: silver;
        Padding: 10pt;
        z-index: 1;
        }

        #maintext
        {
        position: absolute;
        top: 250px;
        left: 250px;
        width: 300px;
        height: 25;
        Font-family: Saturday Sans ICG, Tekton;
        Font-size: 14pt;
        Font-weight: Bold;
        z-index: 0;
        }
-->
</STYLE>
</HEAD>

<BODY onLoad="init()" BGCOLOR="#00004b" TEXT="silver" LINK="black" VLINK="black" ALINK="black">

<HR>
<DIV ID=menu1Div>
<A HREF="javascript: hidepoptext();">
ATI</A>
</DIV>

<DIV ID=poptext1Div>
<A HREF="9800p.html">
Radeon 9800 Pro 128MB
</A>
<BR>
<A HREF="9700p.html">
Radeon 9700 Pro 128MB
</A>
</DIV>

<DIV ID=maintext>
<CENTER>
Text
<HR WIDTH="75%">
</CENTER>
</DIV>

</BODY>
</HTML>
 
No one knows CSS and a little DHTML? I wrote this a year or more ago. When I tested it on my version of mozilla it doesn't work. It's just a drop down window when you click a link. It works in IE perfectly.
 
For Mozilla and newer browsers you should be checking for the w3c html dom.

Code:
if (document.getElementById) { }
 
Thanks for the reply. Can you explain how I use this tag in my situation? I was googling it and there were a bunch of non-related applications. It's been a long time since I first took java script.
 
tried to show how to do it in your current code
but it could be cleaned up alot.

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script type="text/javascript" language="JavaScript1.2">
if (document.getElementById) {
	w3=1;ie=0;n=0;
} else if (document.layers) {
	n=1;ie=0;
} else if (document.all) {
	n=0;ie=1;
}

 function init()
        {
        if (w3) tab = document.getElementById("menu1Div").style;
        if (w3) poptext = document.getElementById("poptext1Div").style;
        
        if (n) tab = document.menu1Div
        if (n) poptext = document.poptext1Div

        if (ie) tab = menu1Div.style
        if (ie) poptext = poptext1Div.style
        }


var tabShow=1;

 //Hide-Show Layer
 function hidepoptext()
 {
        if (tabShow == 0)
        {
        		if (w3) {
        		poptext.visibility = "hidden"
        		tabShow = 1;
        		return;
        		}
        		
                if (n) {
                poptext.visibility = "hide";
                tabShow = 1;
                return;
                         }
                if (ie) {
                poptext.visibility = "hidden";
                tabShow = 1;
                return;
                          }
        }

        if (tabShow == 1)
        {
        		if (w3) {
        		 poptext.visibility = "visible";
        		 tabShow = 0;
        		}
        		
                if (n) {
                poptext.visibility = "show";
                tabShow = 0;
                          }
                if (ie) {
                poptext.visibility = "visible";
                tabShow = 0;
                          }
         }
 }

</script>
<style type="text/css">
<!--
        #menu1div
        {
        position: absolute;
        top: 150px;
        left: 50px;
        width: 87;
        height: 25;
        Padding: 0pt;
        Margin: 0pt;
        Font
        Font-family: Saturday Sans ICG, Tekton;
        Font-size: 14pt;
        Font-weight: Bold;
        Border-color: silver;
        Background-color: gray;
        z-index: 2;

        }

        #poptext1div
        {
        visibility: hide;
        visibility: hidden;
        position: absolute;
        width: 200px;
        top: 175px;
        left: 50px;
        Border: .01pt;
        Border-color: silver;
        Background-color: silver;
        Padding: 10pt;
        z-index: 1;
        }

        #maintext
        {
        position: absolute;
        top: 250px;
        left: 250px;
        width: 300px;
        height: 25;
        Font-family: Saturday Sans ICG, Tekton;
        Font-size: 14pt;
        Font-weight: Bold;
        z-index: 0;
        }
-->
</style>
<title></title>
</head>
<body onload="init()" bgcolor="#00004B" text="silver" link="black"
vlink="black" alink="black">
<hr>
<div id="menu1Div"><a href=
"javascript:%20hidepoptext();">ATI</a></div>

<div id="poptext1Div"><a href="9800p.html">Radeon 9800 Pro
128MB</a><br>
<a href="9700p.html">Radeon 9700 Pro 128MB</a></div>

<div id="maintext">
<center>Text 
<hr width="75%">
</center>
</div>
</body>
</html>
 
Back