为什么javascript无法获得表单值?

J.J*_*.J. 0 html javascript

我试图从表单中检索此值,但它没有返回任何内容.该如何修复?谁能指出我正确的方向?

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;
  }
}
Run Code Online (Sandbox Code Playgroud)

Zha*_* Yi 5

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

var recid = document.theform.recid[i].value;
Run Code Online (Sandbox Code Playgroud)