I want to just check whether a radio button is selected or not through javascript. I am getting an  object is undefined error with the below code.
function ValidateRadioButton() {
  if (document.form1.optfirst.checked == true)
  {
    alert("Option1 is checked");
  } else if (document.form1.optsecond.checked == true) {
    alert("Option2 is checked");
  }
  return false;
}
 
     
    