我正在尝试从表单中检索此值,但未返回任何内容。应该如何解决?谁能指出我正确的方向?

function checkForm()
{
  numrows = document.theform.numrows.value;
  if(numrows == -1)
  {
    alert("You have not chosen any options yet");
    return false;
  }

  emailcheckcount = 0;
  for(i=0; i<=numrows; i++)
  {
      var recid = document.theform.recid'+i+'.value; //why is this failing to get value here?
      alert("Test" + recid);
      return false;
  }
}

最佳答案

请尝试使用数组来访问值:

var recid = document.theform.recid[i].value;

关于javascript - 为什么javascript无法获取表格值?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/33119463/

10-09 23:21