computerhakk
VIP Member
I know there are a few Javascript writers, I hope you guys can help me sort this code out.
What the code is basically doing now is instead of hiding the text.. it is showing the text. So whenever you go onto the page, instead of you clicking on the text to show first, it is already shown. If you click on it, then it'll hide. Which is the opposit of what I want. I wanted it to hide first.
The code is:
To make it work, you need this:
All that will go into the <body> tag
Here is an example of what I roughly want it to do:
http://moofx.mad4milk.net/
Basically, if you click on the Green titles (which in this case is the show/hide buttons).. it shows shows the text. Then it hides the others.
What is happening with the code above is that instead of hiding, everything is showing.
What the code is basically doing now is instead of hiding the text.. it is showing the text. So whenever you go onto the page, instead of you clicking on the text to show first, it is already shown. If you click on it, then it'll hide. Which is the opposit of what I want. I wanted it to hide first.
The code is:
Code:
<script type="text/javascript">
<!--
function toggle_visibility(id) {
var e = document.getElementById(id);
if(e.style.display == 'none')
e.style.display = 'block';
else
e.style.display = 'none';
}
//-->
</script>
Code:
<a href="#" onclick="toggle_visibility('ID');">The id</a><div id="ID">This is the id</div>
Here is an example of what I roughly want it to do:
http://moofx.mad4milk.net/
Basically, if you click on the Green titles (which in this case is the show/hide buttons).. it shows shows the text. Then it hides the others.
What is happening with the code above is that instead of hiding, everything is showing.
Last edited: