I have a checkbox on a form which is unchecked by default as usual. now I want to perform two separated actions on checked and unchecked state of this checkbox.
this
If you debug your code using developer tools, you will notice that this refers to the window object and not the input control. Consider using the passed in id to retrieve the input and check for checked value.
function doalert(id){
if(document.getElementById(id).checked) {
alert('checked');
}else{
alert('unchecked');
}
}