javascript confirm value not working
<p>i have a confirm and alert message box.
both are getting displayed at the right time.</p>

<p>but in confirm box when i press cancel the applyaction_button_click is getting executed, which should not happen as i return false.</p>

<p>Similar is the case with alert box which returns false still applyaction_button_click is getting executed.</p>

<p>here is my code:</p>

<pre><code>   protected void Page_Load(object sender, EventArgs e)
    {
                    ApplyAction_Button.Attributes.Add("onclick", "ShowConfirm();");
}

   protected void ApplyAction_Button_Click(object sender, EventArgs e)
    {
       // Action to be applied
    }
</code></pre>

<p>JS function:</p>

<pre><code>    function ShowConfirm() {
      //check if checkbox is checked if is checked then display confirm message else display alert message
      var frm = document.forms['aspnetForm'];
      var flag = false;
      for (var i = 0; i &lt; document.forms[0].length; i++) {
          if (document.forms[0].elements[i].id.indexOf('Select_CheckBox') != -1) {
              if (document.forms[0].elements[i].checked) {
                  flag = true
              }
          }
      }

      if (flag == true) {
          if (confirm("Are you sure you want to proceed?") == true) {
              return true;
          }
          else {
              return false;
          }
      } else {
      alert('Please select at least Checkbox.')
      return false;
      }
  }
</code></pre>

<p>thanks</p>
