JavaScript-Experten Meinung…

Hallo ich hoffe es kann mir von euch JavaScript-Experten jemand sagen warum mein 4. Menü nicht funktioniert. Ich habe das script irgendwo aus dem internet her (natürlich zur privaten verwendung…) aber jetzt sind nur 3 menus dort programmiert worden und ich bräuchte mehrere… Jetzt hab ich mich hingesetzt und hab es versucht ein 4. Menü nach dem vorgegebenen muster zuprogrammieren. leider mit wenig erfolg. jetzt hoffe ich das ihr mir weiter helfen könnt.

hier das ursprungsscript:

[php]

function clean ()
{
if ((navigator.appName==’Netscape’) && (navigator.appVersion.charAt (0)<'5'))
{
window.document.b.visibility=”hide”;
window.document.m1.visibility=”hide”;
window.document.m2.visibility=”hide”;
window.document.m3.visibility=”hide”;
return;
}
if (navigator.appVersion.charAt (0)<'5')
{
var layers=document.all.tags (“div”);
}
else {
var layers=document.getElementsByTagName(“div”);
}
layers[0].style.visibility=’hidden’;
layers[2].style.visibility=’hidden’;
layers[4].style.visibility=’hidden’;
layers[6].style.visibility=’hidden’;
return;
}

function menu (i)
{

switch(i)
{
case 1:
{
if ((navigator.appName==’Netscape’) && (navigator.appVersion.charAt(0)<'5'))
{
window.document.b.visibility=”show”;
window.document.m1.visibility=”show”;
window.document.m2.visibility=”hide”;
window.document.m3.visibility=”hide”;
return;
}
if (navigator.appVersion.charAt (0)<'5')
{
var layers=document.all.tags (“div”);
}
else {
var layers=document.getElementsByTagName(“div”);
}
layers[0].style.visibility=’visible’;
layers[2].style.visibility=’visible’;
layers[4].style.visibility=’hidden’;
layers[6].style.visibility=’hidden’;
return;
}
case 2:
{
if ((navigator.appName==’Netscape’) && (navigator.appVersion.charAt(0)<'5'))
{
window.document.b.visibility=”show”;
window.document.m1.visibility=”hide”;
window.document.m2.visibility=”show”;
window.document.m3.visibility=”hide”;
return;
}
if (navigator.appVersion.charAt (0)<'5')
{
var layers=document.all.tags (“div”);
}
else {
var layers=document.getElementsByTagName(“div”);
}
layers[0].style.visibility=’visible’;
layers[2].style.visibility=’hidden’;
layers[4].style.visibility=’visible’;
layers[6].style.visibility=’hidden’;
return;
}
case 3:
{
if ((navigator.appName==’Netscape’) && (navigator.appVersion.charAt(0)<'5'))
{
window.document.b.visibility=”show”;
window.document.m1.visibility=”hide”;
window.document.m2.visibility=”hide”;
window.document.m3.visibility=”show”;
return;
}
if (navigator.appVersion.charAt (0)<'5')
{
var layers=document.all.tags (“div”);
}
else {
var layers=document.getElementsByTagName(“div”);
}
layers[0].style.visibility=’visible’;
layers[2].style.visibility=’hidden’;
layers[4].style.visibility=’hidden’;
layers[6].style.visibility=’visible’;
return;
}
}

}
[/php] und hier mein versuch:

[php]
function clean ()
{
if ((navigator.appName==’Netscape’) && (navigator.appVersion.charAt (0)<'5'))
{
window.document.b.visibility=”hide”;
window.document.m1.visibility=”hide”;
window.document.m2.visibility=”hide”;
window.document.m3.visibility=”hide”;
window.document.m4.visibility=”hide”;
return;
}
if (navigator.appVersion.charAt (0)<'5')
{
var layers=document.all.tags (“div”);
}
else {
var layers=document.getElementsByTagName(“div”);
}
layers[0].style.visibility=’hidden’;
layers[2].style.visibility=’hidden’;
layers[4].style.visibility=’hidden’;
layers[6].style.visibility=’hidden’;
layers[8].style.visibility=’hidden’;
return;
}

function menu (i)
{

switch(i)
{
case 1:
{
if ((navigator.appName==’Netscape’) && (navigator.appVersion.charAt(0)<'5'))
{
window.document.b.visibility=”show”;
window.document.m1.visibility=”show”;
window.document.m2.visibility=”hide”;
window.document.m3.visibility=”hide”;
window.document.m4.visibility=”hide”;
return;
}
if (navigator.appVersion.charAt (0)<'5')
{
var layers=document.all.tags (“div”);
}
else {
var layers=document.getElementsByTagName(“div”);
}
layers[0].style.visibility=’visible’;
layers[2].style.visibility=’visible’;
layers[4].style.visibility=’hidden’;
layers[6].style.visibility=’hidden’;
layers[8].style.visibility=’hidden’;
return;
}
case 2:
{
if ((navigator.appName==’Netscape’) && (navigator.appVersion.charAt(0)<'5'))
{
window.document.b.visibility=”show”;
window.document.m1.visibility=”hide”;
window.document.m2.visibility=”show”;
window.document.m3.visibility=”hide”;
window.document.m4.visibility=”hide”;
return;
}
if (navigator.appVersion.charAt (0)<'5')
{
var layers=document.all.tags (“div”);
}
else {
var layers=document.getElementsByTagName(“div”);
}
layers[0].style.visibility=’visible’;
layers[2].style.visibility=’hidden’;
layers[4].style.visibility=’visible’;
layers[6].style.visibility=’hidden’;
layers[8].style.visibility=’hidden’;
return;
}
case 3:
{
if ((navigator.appName==’Netscape’) && (navigator.appVersion.charAt(0)<'5'))
{
window.document.b.visibility=”show”;
window.document.m1.visibility=”hide”;
window.document.m2.visibility=”hide”;
window.document.m3.visibility=”show”;
window.document.m4.visibility=”hide”;
return;
}
if (navigator.appVersion.charAt (0)<'5')
{
var layers=document.all.tags (“div”);
}
else {
var layers=document.getElementsByTagName(“div”);
}
layers[0].style.visibility=’visible’;
layers[2].style.visibility=’hidden’;
layers[4].style.visibility=’hidden’;
layers[6].style.visibility=’visible’;
layers[8].style.visibility=’hidden’;
return;
}
case 4:
{
if ((navigator.appName==’Netscape’) && (navigator.appVersion.charAT(0)<'5'))
{
window.document.b.visibility=”show”;
window.document.m1.visibility=”hide”;
window.document.m2.visibility=”hide”;
window.document.m3.visibility=”hide”;
window.document.m4.visibility=”show”;
return;
}
if (navigator.appVersion.charAt (0)<'5')
{
var layers=document.all.tags (“div”);
}
else {
var layers=document.getElementsByTagName(“div”);
}
layers[0].style.visibility=’visible’;
layers[2].style.visibility=’hidden’;
layers[4].style.visibility=’hidden’;
layers[6].style.visibility=’hidden’;
layers[8].style.visibility=’visible’;
return;
}
}

}
[/php]

Leave a Reply

Your email address will not be published. Required fields are marked *