I have a form that I am using a javascript with and I am trying to make it so if someone checks a checkbox, it will do one thing and if it is left unchecked, it will do another. For some reason it keeps inserting the value of the first if statement whether it is checked or not.

Can somebody please tell me what I need to do to make it print the first value if it is checked, and the second if it is left unchecked?

  if (external = "yes") {
   form.external.value = 'target="_blank"';
  } else {
   form.external.value = '';
<input name="external" type="checkbox" value="yes" />