...

View Full Version : Javascript Checkbox Confirm



gbotley
08-21-2011, 11:33 PM
Hello,

I'm new to Javascript, but have been programming in PHP and other web codes for 4 years now.

I was wondering how you would check if a checkbox was ticked, upon its selection and then unhide HTML content, and then hide such content when deselected..

So far I have this:




<script type="text/javascript">
function Agree() {
document.getElementById("stepTwo").className = "";
}
</script>




Which is called by onclick="Agree()" on the select box itself..

I understand an if statement is needed, but how would one go about doing this as my if statements do not appear to be working.

xelawho
08-21-2011, 11:47 PM
if (document.getElementById("mycheckbox").checked == true) {
document.getElementById("stepTwo").style.display="inline";
} else {
document.getElementById("stepTwo").style.display="none";
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum