98
rated 0 times
[
101]
[
3]
/ answers: 1 / hits: 24735
/ 12 Years ago, sat, october 27, 2012, 12:00:00
I'm just trying to get this checkbox to alert a message after it is checked and after it is unchecked by running a function in Javascript. I can get it to display the checked message but can't get the unchecked alert to come up.
<input type=checkbox id=chbx onchange=foo()>
<script type=text/javascript>
var checkbox = document.getElementById(chbx);
function foo(){
if(checkbox.checked=true){
alert(Checked!);
}
else {
alert(UnChecked!);
}
};
</script>
More From » html