I would like the button on my web page to toggle the visibility of my two check-boxes.
How do I go about implementing such functionality?
<html>
<head>
<script language=javascript>
function validate(chk){
if (chk.style.visibility == 'visible')
chk.style.visibility = 'hidden';
else
chk.style.visibility = 'visible';
}
</script>
</head>
<body>
<form><span id=t style.visibility="visible" >
<input type=checkbox name=chk1>Please Check Me</span>
<input type=checkbox name=chk1>Please Check Me</span>
<p><input type=button value="check" onclick="return validate(t);">
</form>
</body>
</html>
See Question&Answers more detail:os