Shows you to show / hide a div using Javascript
Showing / Hiding a DIV is very easy. The following function should be inserted just before the end body tag on your page.
<script language="javascript" type="text/javascript">
function showhide(ID){
var tmp = document.getElementById(ID);
if (tmp.style.display=='none'){
tmp.style.display = '';
}else{
tmp.style.display = 'none';
}
}
</script>
The following function can then be called to toggle the divs display status:
<div id="helloworld">Hello World</div>
<div onclick="showhide('helloworld');">Show / Hide</div>
Hope this helps you out
created on 20/12/2009 @ 15:57, last updated on 09/03/2010 @ 19:51
There are no comments for this tutorial yet.