html代码:
<form>
<P>1、印在纸上的主意、想法,其价值还不如印它们的纸张。<BR>
<INPUT type=radio value=1 name="c1"> 非常同意
<INPUT type=radio value=3 name="c1"> 比较同意
<INPUT type=radio value=5 name="c1"> 稍许同意
<INPUT type=radio value=V1 name="c1"> 不太同意
<INPUT type=radio value=V2 name="c1"> 很不同意
<INPUT type=radio value=V3 name="c1"> 极不同意
</P>
<input onclick="TrainingEvaluationsConsciousness(this.form)" type="button" value="查看测评结果" name="button">
</form>
函数:
function TrainingEvaluationsConsciousness(form){
var xf,hc1;
xf=hc1=-3;
//loops through the radio buttons finding out which one is selected
//***程序走到这一步就报错了,说的是Cannot read property 'c1' of null***
if (form.c1[1].checked==1) hc1=-2;
if (form.c1[2].checked==1) hc1=-1;
if (form.c1[3].checked==1) hc1=1;
if (form.c1[4].checked==1) hc1=2;
if (form.c1[5].checked==1) hc1=3;
xf=hc1;
alert(xf);
}
Cannot read property 'c1' of null,是说你传过来的form是null,也就是this.form是null,不过我试了你的代码,跟楼上的一样,没有问题,估计是你的页面标签结构乱了,或者什么原因,导致this.form没找到吧