gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-28 13:20:57 27 4
gpt4 key购买 nike

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

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/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com