How to make onclick for show or hide div?
Dec 01
it is easy! to show div in javascript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | <style>
#hide_show{
display:none
}
</style>
<script language="javascript">
function hidediv(div) {
if (document.getElementById)
document.poppedLayer = eval('document.getElementById(div)');
else if (document.all)
document.poppedLayer = eval('document.all[div]');
else
document.poppedLayer = eval('document.layers[div]');
document.poppedLayer.style.display = "none";
}
function showdiv(div) {
if (document.getElementById)
document.poppedLayer = eval('document.getElementById(div)');
else if (document.all)
document.poppedLayer = eval('document.all[div]');
else
document.poppedLayer = eval('document.layers[div]');
document.poppedLayer.style.display = "block";
}
</script>
<a href="#" onclick="showdiv('hide_show')">show</a>
<a href="#" onclick="hidediv('hide_show')">show</a>
<div id="hide_show">
<h1>Here I am!</h1>
</div> |