Hi! This is my first post here.
My Problem is, that Ive written a Javascript-Funktion that hides a DIV when clicking on an image. But the Script only runs proper on IE but not Opera and Mozilla (other browsers I didnt try).
Maybe anyone can tell my why Opera and Mozilla dont get the script right.
I wrote a similar script a while ago, but instead of working with “parentNode” and “nextSibling” I assigned IDs to the elements. That script did it the right way, also in Opera and Mozilla. But this isnt what Im after since you will have to give every new DIV an individual ID….but maybe you guys just take a look at the code…
[code=html]<html>
<head>
<meta http-equiv=”content-type” content=”text/html;charset=iso-8859-1″>
<meta name=”generator” content=”Adobe GoLive”>
<title>Layout_Testseite</title>
<style type=”text/css” media=”screen”><!–
body { text-align: center; margin: 50px 0 0; padding: 0 }
#container { margin: 0 auto; width: 350px }
.box { border: solid 1px #999 }
–></style>
<script type=”text/javascript”>
function changeVisibility(element){
var handledElement = element.parentNode.nextSibling;
handledElement.style.display = (handledElement.style.display == “none”) ? “” : “none”;
}
</script>
</head>
<body>
<div id=”container”>
<div class=”box”>
<div>
<img src=”” alt=”Auf- und Zuklappen” height=”15″ width=”15″ onclick=”changeVisibility(this)”>
Formular
</div>
<div>
sdaadasdadadada<br>
sdadadada<br>
asdadad<br>
sdasdasd<br>
asdadas<br>
sdadasdadasdasads<br>
adad
</div>
</div>
</div>
</body>
</html>