49
rated 0 times
[
52]
[
3]
/ answers: 1 / hits: 156116
/ 12 Years ago, mon, july 9, 2012, 12:00:00
Hello I have the following 2 JavaScript functions to open up a div and to close it.
<script>
function show() {
if(document.getElementById('benefits').style.display=='none') {
document.getElementById('benefits').style.display='block';
}
}
</script>
<script>
function close() {
if(document.getElementById('benefits').style.display=='block') {
document.getElementById('benefits').style.display='none';
}
}
</script>
Here is the html:
<div id=opener><a href=#1 name=1 onclick=show()>click here</a></div>
<div id=benefits style=display:none;>
some input in here plus the close button
<div id=upbutton><a onclick=close()></a></div>
</div>
For some reason the show function works how it should, but the close button does not do its job. So if there is someone who could help me out I really would appreciate. Thanks a lot.
More From » function