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

为什么javascript无法获取表单值?,javascript,html,Javascript,Html,我试图从表单中检索此值,但它没有返回任何内容。这应该如何解决?谁能给我指出正确的方向吗 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<=nu

我试图从表单中检索此值,但它没有返回任何内容。这应该如何解决?谁能给我指出正确的方向吗

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;
  }
}
函数检查表()
{
numrows=document.theform.numrows.value;
如果(numrows==-1)
{
警告(“您尚未选择任何选项”);
返回false;
}
emailcheckcount=0;

对于(i=0;i请尝试使用数组访问值:

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

请尝试使用数组访问值:

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

该文件的语法。表单。ReordD'+I+'。值不正确。是否检查了任何错误消息的浏览器日志。请考虑添加一个HTML表单的代码片段,其中调用该函数,以便有人希望回答的信息可能更多。也请指定是否获得警报。如果您使用的是Firefox/Chrome浏览器尝试控制台。日志打印一些调试消息。此行文档的语法。表单。ReordD’+I+'。值不正确。是否检查过任何错误消息的浏览器日志。请考虑添加一个HTML表单的代码片段,其中调用该函数,以便有人希望回答的信息可能更多。也请指定是否获得ALER。t、 如果您使用的是firefox/chrome浏览器,请尝试console.log打印一些调试消息。