Forum Moderators: open
<script type="text/javascript">
function showhide(divid, state){
document.getElementById(divid).style.display=state
}
</script> <a href="#" onClick="showhide('testdiv1 , testdiv2' , 'block'); return false" >Show DIV</a> | <a href="#" onClick="showhide('testdiv1, testdiv2', 'none'); return false" >Hide DIV</a> <a href="#" onClick="showhide('testdiv1', 'block'); return false" >Show DIV</a> | <a href="#" onClick="showhide('testdiv1', 'none'); return false" >Hide DIV</a> //will take any number of string element id's as arguments,
//followed by the display state desired must be last string fed in
//EXAMPLE: showhide('elementOneId', 'elementTwoId', 'elementThreeId', 'block');
function showhide() {
var el,
i = 0,
a = arguments,
len = a.length - 1,
state = a[len];
while (i < len) {
el = document.getElementById(a[i++]);
if (el !== null) {
el.style.display = state;
}
}
}