messmar
Erfahrenes Mitglied
Hallo,
kann jemand mir hier bitte sagen warum diese Navi in Firefox nicht geht bzw. funktioniert?
1000 Dank.
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style>
body {margin: 0 0 0 18px; padding:0;}
</style>
<script>
function displaySubNav(li, display) {
var ul = li.getElementsByTagName('ul');
if (ul && ul[0])
ul[0].style.display = display;
if (display=='block') {
li.firstChild.style.color='0050AA';
li.firstChild.style.fontSize='10px';
li.firstChild.style.fontWeight='bold';
} else {
li.firstChild.style.color='0050AA';
li.firstChild.style.fontWeight='normal';
}
}
function hideNavigation() {
var nav = document.getElementById('nav');
var item = nav.firstChild;
while (item) {
if (item.tagName && item.tagName.toLowerCase() == "li") {
displaySubNav(item, "none");
}
item = item.nextSibling;
}
}
function showNavigation(li) {
hideNavigation();
displaySubNav(li, "block");
}
//-->
</script>
</head>
<body onload="hideNavigation()">
<ul id="nav">
<li><a href="#" onclick="showNavigation(this.parentNode);">Punkt 1</a>
<ul>
<li>Subpunkt 1.1</li>
<li>Subpunkt 1.2</li>
<li>Subpunkt 1.3</li>
</ul>
</li>
<li><a href="#" onclick="showNavigation(this.parentNode);">Punkt 2</a>
<ul>
<li>Subpunkt 2.1</li>
<li>Subpunkt 2.2</li>
<li>Subpunkt 2.3</li>
</ul>
</li>
<li><a href="#" onclick="showNavigation(this.parentNode);">Punkt 3</a>
<ul>
<li>Subpunkt 3.1</li>
<li>Subpunkt 3.2</li>
<li>Subpunkt 3.3</li>
</ul>
</li>
<li><a href="#" onclick="showNavigation(this.parentNode);">Punkt 1</a>
<ul>
<li>Subpunkt 1.1</li>
<li>Subpunkt 1.2</li>
<li>Subpunkt 1.3</li>
</ul>
</li>
<li><a href="#" onclick="showNavigation(this.parentNode);">Punkt 2</a>
<ul>
<li>Subpunkt 2.1</li>
<li>Subpunkt 2.2</li>
<li>Subpunkt 2.3</li>
</ul>
</li>
<li><a href="#" onclick="showNavigation(this.parentNode);">Punkt 3</a>
<ul>
<li>Subpunkt 3.1</li>
<li>Subpunkt 3.2</li>
<li>Subpunkt 3.3</li>
</ul>
</li>
</ul>
</body>
</html>
kann jemand mir hier bitte sagen warum diese Navi in Firefox nicht geht bzw. funktioniert?
1000 Dank.
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style>
body {margin: 0 0 0 18px; padding:0;}
</style>
<script>
function displaySubNav(li, display) {
var ul = li.getElementsByTagName('ul');
if (ul && ul[0])
ul[0].style.display = display;
if (display=='block') {
li.firstChild.style.color='0050AA';
li.firstChild.style.fontSize='10px';
li.firstChild.style.fontWeight='bold';
} else {
li.firstChild.style.color='0050AA';
li.firstChild.style.fontWeight='normal';
}
}
function hideNavigation() {
var nav = document.getElementById('nav');
var item = nav.firstChild;
while (item) {
if (item.tagName && item.tagName.toLowerCase() == "li") {
displaySubNav(item, "none");
}
item = item.nextSibling;
}
}
function showNavigation(li) {
hideNavigation();
displaySubNav(li, "block");
}
//-->
</script>
</head>
<body onload="hideNavigation()">
<ul id="nav">
<li><a href="#" onclick="showNavigation(this.parentNode);">Punkt 1</a>
<ul>
<li>Subpunkt 1.1</li>
<li>Subpunkt 1.2</li>
<li>Subpunkt 1.3</li>
</ul>
</li>
<li><a href="#" onclick="showNavigation(this.parentNode);">Punkt 2</a>
<ul>
<li>Subpunkt 2.1</li>
<li>Subpunkt 2.2</li>
<li>Subpunkt 2.3</li>
</ul>
</li>
<li><a href="#" onclick="showNavigation(this.parentNode);">Punkt 3</a>
<ul>
<li>Subpunkt 3.1</li>
<li>Subpunkt 3.2</li>
<li>Subpunkt 3.3</li>
</ul>
</li>
<li><a href="#" onclick="showNavigation(this.parentNode);">Punkt 1</a>
<ul>
<li>Subpunkt 1.1</li>
<li>Subpunkt 1.2</li>
<li>Subpunkt 1.3</li>
</ul>
</li>
<li><a href="#" onclick="showNavigation(this.parentNode);">Punkt 2</a>
<ul>
<li>Subpunkt 2.1</li>
<li>Subpunkt 2.2</li>
<li>Subpunkt 2.3</li>
</ul>
</li>
<li><a href="#" onclick="showNavigation(this.parentNode);">Punkt 3</a>
<ul>
<li>Subpunkt 3.1</li>
<li>Subpunkt 3.2</li>
<li>Subpunkt 3.3</li>
</ul>
</li>
</ul>
</body>
</html>