gpt4 book ai didi

javascript - 为什么我的 html、JS 测试不起作用?

转载 作者:行者123 更新时间:2023-11-28 19:50:22 25 4
gpt4 key购买 nike

我们从老师那里得到了这段代码,以便我们可以从中学习。简单来说,这是 10 个问题的测试,每个问题有 3 个可能的答案。如果您点击“好答案数量”按钮,它应该会返回实际的好答案数量。我无法在最新的 Chrome、IE 等下运行此程序。每次我点击底部的“好答案数”按钮时,我什么也得不到或为零。唯一真正能运行它的浏览器是 PSPad 的超老 IE。

<html>
<head>
<title>Test HTML</title>


<SCRIPT language=JavaScript>
var contents = true;

function counter(form)
{
var equal=0;
if (form.o1[2].status==true) equal++
if (form.o2[0].status==true) equal++
if (form.o3[1].status==true) equal++
if (form.o4[0].status==true) equal++
if (form.o5[0].status==true) equal++
if (form.o6[1].status==true) equal++
if (form.o7[0].status==true) equal++
if (form.o8[1].status==true) equal++
if (form.o9[0].status==true) equal++
if (form.o10[2].status==true) equal++
{
form.right.value=" "+equal;
}
}
</SCRIPT>



<META http-equiv=Content-Type content="text/html; charset=windows-1250">
</head>
<DIV align=center>
<H3><B>TEST<br>HTML</B></H3>
<HR width="90%" color=#ffff00>
</DIV>
<FORM name=test method=post>
<TABLE width="100%" border=0>
<TBODY>
<TR vAlign=top><TD width="70%">
<OL>
<LI>q1</LI></OL>
<BLOCKQUOTE>
<br><INPUT type=radio value=A name=o1> Answer0
<br><INPUT type=radio value=B name=o1> Answer1
<br><INPUT type=radio value=C name=o1> Answer2
</BLOCKQUOTE>

<TR vAlign=top><TD width="70%">
<OL>
<LI value=2>q2</LI></OL>
<BLOCKQUOTE>
<br><INPUT type=radio value=A name=o2> Answer0
<br><INPUT type=radio value=B name=o2> Answer1
<br><INPUT type=radio value=C name=o2> Answer2
</BLOCKQUOTE>

<TR vAlign=top><TD width="70%">
<OL>
<LI value=3>q3</LI></OL>
<BLOCKQUOTE>
<br><INPUT type=radio value=A name=o3> Answer0
<br><INPUT type=radio value=B name=o3> Answer1
<br><INPUT type=radio value=C name=o3> Answer2
</BLOCKQUOTE>

<TR vAlign=top><TD width="70%">
<OL>
<LI value=4>q4</LI></OL>
<BLOCKQUOTE>
<br><INPUT type=radio value=A name=o4> Answer0
<br><INPUT type=radio value=B name=o4> Answer1
<br><INPUT type=radio value=C name=o4> Answer2
</BLOCKQUOTE>

<TR vAlign=top><TD width="70%">
<OL>
<LI value=5>q5</LI></OL>
<BLOCKQUOTE>
<br><INPUT type=radio value=A name=o5> Answer0
<br><INPUT type=radio value=A name=o5> Answer1
<br><INPUT type=radio value=A name=o5> Answer2
</BLOCKQUOTE>

<TR vAlign=top><TD width="70%">
<OL>
<LI value=6>q6</LI></OL>
<BLOCKQUOTE>
<br><INPUT type=radio value=A name=o6> Answer0
<br><INPUT type=radio value=A name=o6> Answer1
<br><INPUT type=radio value=A name=o6> Answer2
</BLOCKQUOTE>

<TR vAlign=top><TD width="70%">
<OL>
<LI value=7>q7</LI></OL>
<BLOCKQUOTE>
<br><INPUT type=radio value=A name=o7> Answer0
<br><INPUT type=radio value=A name=o7> Answer1
<br><INPUT type=radio value=A name=o7> Answer2
</BLOCKQUOTE>

<TR vAlign=top><TD width="70%">
<OL>
<LI value=8>q8</LI></OL>
<BLOCKQUOTE>
<br><INPUT type=radio value=A name=o8> Answer0
<br><INPUT type=radio value=A name=o8> Answer1
<br><INPUT type=radio value=A name=o8> Answer2
</BLOCKQUOTE>

<TR vAlign=top><TD width="70%">
<OL>
<LI value=9>q9</LI></OL>
<BLOCKQUOTE>
<br><INPUT type=radio value=A name=o9> Answer0
<br><INPUT type=radio value=A name=o9> Answer1
<br><INPUT type=radio value=A name=o9> Answer2
</BLOCKQUOTE>

<TR vAlign=top><TD width="70%">
<OL>
<LI value=10>q10</LI></OL>
<BLOCKQUOTE>
<br><INPUT type=radio value=A name=o10> Answer0
<br><INPUT type=radio value=A name=o10> Answer1
<br><INPUT type=radio value=A name=o10> Answer2
</BLOCKQUOTE>
</TBODY>
</TABLE>
<HR width="90%" color=#ffff00>
<P align=center>
<INPUT style="FONT-SIZE: 8pt; FONT-FAMILY: Tahoma" onclick="return counter(this.form)" type=button value="Number of good answers">
<INPUT size=5 name=right>
</FORM>
</BODY>
</HTML>

谢谢你解决了我的问题。我的 JS 不太好。

编辑:谢谢你们,你们真的是最棒的。 :)

最佳答案

脚本正在检查输入的status属性。仅旧版本的 Internet Explorer 支持此属性。

关于javascript - 为什么我的 html、JS 测试不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23550541/

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