Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/403.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 10秒后禁用单选按钮_Php_Javascript_Radio Button - Fatal编程技术网

Php 10秒后禁用单选按钮

Php 10秒后禁用单选按钮,php,javascript,radio-button,Php,Javascript,Radio Button,我禁用单选按钮有问题 我使用php从mysql db生成一些选项,如下所示: <input type=\"radio\" name=\"answer\" id=\"answer\" value=\"".$inhAnswer['id']."\"/> 这是有效的。但我需要的是禁用所有按钮,我无法理解这一点。现在我只能禁用第一个。我知道该文档。form1.answer[1]等将禁用其他文档,但我不知道将使用多少单选按钮 那么,如何让脚本一次禁用所有应答单选按钮 干杯 托比 但我不知道会

我禁用单选按钮有问题

我使用php从mysql db生成一些选项,如下所示:

 <input type=\"radio\" name=\"answer\" id=\"answer\" value=\"".$inhAnswer['id']."\"/>
这是有效的。但我需要的是禁用所有按钮,我无法理解这一点。现在我只能禁用第一个。我知道该文档。form1.answer[1]等将禁用其他文档,但我不知道将使用多少单选按钮

那么,如何让脚本一次禁用所有应答单选按钮

干杯

托比

但我不知道会用多少个单选按钮

总数为:
document.form1.answer.length


医生:

我不是很确定,但你可以试试这样的

var children = document.form1.answer;

for(var i=0; i<children.length; i++) {
     children[i].disabled = true;
}
var children=document.form1.answer;

对于(VarI=0;iThanks-Hakre)这就是我现在所做的,这是有效的:VarI=0;对于(i=0;i
var children = document.form1.answer;

for(var i=0; i<children.length; i++) {
     children[i].disabled = true;
}