无法获得Javascript功能

时间:2013-02-07 12:05:15

标签: javascript

我在下面的Javascript函数中调用了来自一个无线电组的点击,其中有3个选项,Pass,Fail和NA。我没有语法错误,或Firebug中的任何消息,但它没有将值写回输出文本框。关于我缺少的任何想法?

function ScoreCount() {
  var CompScore = 0;
  var CompTotal = 0;
  var CompPercent = 0;
  var CustDetCount = 0;

  var C01Selected = "",
      C02Selected = "",
      C03Selected = "",
      //...
      C51Selected = "";

  for (i = 0; i < 3; i++) {
    if (document.MonitorForm.PMC_C01[i].checked == true) {
      C01Selected = document.MonitorForm.PMC_C01[i].value;
    }
  }

  if (C01Selected == "Pass") {
    CompScore = (CompScore + 1);
    CompTotal = (CompTotal + 1);
    CompPercent = (parseFloat(CompScore) / parseFloat(CompTotal));
  } else if (C01Selected == "Fail") {
    CompTotal = (CompTotal + 1);
    CompPercent = (parseFloat(CompScore) / parseFloat(CompTotal));
  } else {
    CompPercent = (parseFloat(CompScore) / parseFloat(CompTotal));
  }

  document.MonitorForm.Comp_Score.value = CompScore;
  document.MonitorForm.Comp_Total.value = CompTotal;
  document.MonitorForm.Comp_Percent.value = CompPercent;
}

0 个答案:

没有答案