Hide And Show DIV's
8
An easy way to hide and show div's using Javascript and CSS.
Basically just a slight variation on this script by Real Gagnon.
Basically just a slight variation on this script by Real Gagnon.
function hide(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 show(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";
}
#MyDiv {
display: none;
}






document.getElementById(id).style.display = (document.getElementById(id).style.display == 'block') ? 'none':'block';
}
or
function show_hide_b(id,disp){
document.getElementById(id).style.display = disp;
}
then you just call the functions like this:
* show_hide('something'); // to use the 1st function
* show_hide_b('something','block'); // to use the 2nd function w/ display:block
* show_hide_b('something','none');// to use the 2nd function w/ display:none
______________________
// a sphincter says what?
Regards,
Kumar S
GuyFromChennai.com