You have 2 problems.
1) You are trying to compare a boolean to a string when you should be comparing a boolean to another boolean.
2) You're using the double equals operator (==), not the triple equals operator (===).
The triple equals operator is better in 99% of cases. It does not do type coercion (Google it); it checks if the values are identical.
Here are some examples to show why you shouldn't use == (aka, the eqeq operator).
true == 'true' // false
false == 'false' // false
false == 0 // true
true == '1' // true
true == 1 // true
null == undefined // true
[HR][/HR]
So we simply change your if () statement in your code to compare .checked to a boolean and not a string, and we also use ===.
function exefunction() {
var lfckv = document.getElementById("lifecheck").checked;
if (lfckv === true) {
alert('ticked');
} else {
alert('NOT ticked');
}
}
Or, since you always call alert (just with a different string), you could shorten your function to this:
function exefunction() {
alert((document.getElementById("lifecheck").checked === true ? 'NOT ' : '') + 'ticked');
}
That is using the ternary operator to shorten it to one line. No variables are necessary because we didn't use anything more than once.