By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,282 Members | 1,548 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,282 IT Pros & Developers. It's quick & easy.

On Untick of a checkbox?

P: n/a
Is this Possible? ive got some code which works onclick and makes a div
visible.

onClick='document.getElementById("question11_comme nt").style.visibility
= "visible";'

Basically, either need a way to do on untick, or on second click. So
the first time they click the box it will make the div visible, and
then the 2nd time, it will make it hidden.

Any ideas please?

Jul 6 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a

"Advo" <ma**********@hotmail.comschreef in bericht
news:11**********************@m73g2000cwd.googlegr oups.com...
Is this Possible? ive got some code which works onclick and makes a div
visible.

onClick='document.getElementById("question11_comme nt").style.visibility
= "visible";'

Basically, either need a way to do on untick, or on second click. So
the first time they click the box it will make the div visible, and
then the 2nd time, it will make it hidden.

Any ideas please?
a sample:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css"<!--
..show{visibility: visible}
..hide{visibility: hidden}
--></style>
<script language="javascript" type="text/javascript">
//<![CDATA[
function showHidediv(strDivId, boolshowhide){
var styleSwitch;
if(boolshowhide) styleSwitch = "show";
else styleSwitch = "hide";
document.getElementById(strDivId).className = styleSwitch;
}
//]]>
</script>
</head>
<body>

<input type="checkbox" id="checkbox1" name="checkbox1"
onclick="showHidediv('thediv', this.checked)">
<div id="thediv" class="hide">abcdefg</div>

</body>
</html>
Jul 6 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.