I have following validation working for text field
function check(){
    var flag = 0;
    if(document.form1.namef.value == ""){
        document.form1.namef.style.backgroundColor='#FF9ECE';
        flag = 1;
    }
    else{
        document.form1.namef.style.backgroundColor='';
    }if(flag){
        return false;
    }
    else{
        return true;
    }
}
I have a form with gender which is not working in validation
<th width="222">Gender<font size="1" color="red">*</font></th>
                    <td width="253"><input type="radio" name="sex" value="0">Male<input type="radio" name="sex" value="1">Female</td>
How can I validate radio button in the function check()?
 
    