问题就是便宜通不过,错误是length不是对象,什么意思?当一页的问题小于4个的时候,编译又没有问题!谢谢指点!
解决方案 »
- jquery 选择器问题
- 各位大侠问一下,下面的程序有什么错无没有,为什么会打不到预期效果
- 一个初学js问题
- 页面本身打开时就在右下角,并在20秒内能自动关闭
- 动态表格生成后台取值问题
- 我想问的是,如何判断除中文字符以外的,全角和半角的符号呢,也包括字母和数字字符!!!
- 新手提问:望请指点
- 如果我从前一个页面传过来两个值,分别代表”残疾类型“和”残疾程序“,从这个程序的构造来看,如何实现两值的关联准确性(表示选中即可
- 关于判断语句疑惑求解释
- 求正则表达式的特殊符号表达
- 像这样http://www.csdn.net/Expert/topic/480/480034.shtm对table的操作那里找?
- javascript中取得字符串长度的函数是what?
下面的四个问题,没有错误:
<HTML>
<HEAD>
<script language="JavaScript">
var Total_Question = 4// 修改这里与题目数量一致
var msg = ""
// 正确答案
var Solution = new Array(Total_Question)
Solution[0] = "一个多小时"
Solution[1] = "4-6分钟"
Solution[2] = "对"
Solution[3] = "对"
//
function GetSelectedButton(ButtonGroup)
{
for (var x=0; x < ButtonGroup.length; x++)
if (ButtonGroup[x].checked) return x
return 0
}
function ReportScore(correct)
{
var SecWin =
window.open("","scorewin","scrollbars,width=300,height=220")
var MustHave1 = "<HTML><HEAD><TITLE>测试成绩报告</TITLE></HEAD><BODY>"
var Percent = "<H2>测试成绩 : "+Math.round(correct/Total_Question*100)
+ "</H2><HR>"
lastscore=Math.round(correct/Total_Question*100)
if (lastscore == "100"){
msg = MustHave1 +Percent + "<font color='red'>恭喜,全部答对了!</font><p>" + msg + "<input type='button' value='关闭' onclick=javascript:window.close()></BODY></HTML>"}
else {
msg = MustHave1 +Percent + "<font color='red'>正确答案:</font><p>" + msg + "<input type='button' value='关闭' onclick=javascript:window.close()></BODY></HTML>"
}
SecWin.document.write(msg)
msg = "" //清空msg
}
function Grade()
{
var correct = 0
var wrong = 0
for (number=0; number < Total_Question; number++)
{
var form = document.forms[number] // Question #
var i = GetSelectedButton(form.q1)
if (form.q1[i].value == "1")
{ correct++ }
else
{ wrong++
msg += "Question "+(number+1)+"."
+Solution[number]+"<BR>"
}
}
ReportScore(correct)
}
</script>
<style type="text/css">
<!--
.pt9 { font: 9pt "宋体"}
body { font: 9pt "宋体" ; margin: 0px}
td { font: 9pt "宋体" }
-->
</style>
<TITLE>您知道怎么自救吗?</TITLE><META HTTP-EQUIV="Generator" CONTENT="Agile HTML Editor, http://www.agilic.com">
</HEAD>
<BODY>
<p align="center"><!--- BEGIN CLICK2NET CODE ---> </p>
<dl>
<dd align="center"> </dd>
<table width="75%" border="0" align="center">
<tr>
<td>
<form>
<p>下列题目中,每题有多个选择答案,根据你的实际情况,选择一个适合你的答案。
</p>
<p>(1)当一辆汽车翻到河里,或是一个小孩掉进冰窟窿后,司机或小孩最长能在水下闷多久而不致溺死?
<br>
<input type="radio" name="q1" value="0" checked>5分钟 <input type="radio" name="q1"
value="1">30多分钟 <input type="radio" name="q1" value="0">一个多小时 <br>
<br></p></form><form>
<p>(2)当人失去知觉时,他的舌头有时会堵住气管你必须在几分钟内把它疏通,否则他的大脑会受到损害:
<br>
<input type="radio" name="q1" value="0" checked>1-2分钟 <input type="radio" name="q1"
value="1">2-4分钟 <input type="radio" name="q1" value="0">4-6分钟 <br>
<br></p></form><form>
<p>(3)现在许多高楼采用玻璃幕墙,玻璃墙不能开启,万一大楼里发生火警,你应该打破玻璃让里面的毒气、烟雾散出去。
<br>
<input type="radio" name="q1" value="1" checked>对 <input type="radio" name="q1"
value="0">错 <br>
<br>
</p>
</form>
<form>
<p>(3)现在许多高楼采用玻璃幕墙,玻璃墙不能开启,万一大楼里发生火警,你应该打破玻璃让里面的毒气、烟雾散出去。
<br>
<input type="radio" name="q1" value="1" checked>对 <input type="radio" name="q1"
value="0">错 <br>
<br>
</p>
</form>
</td></tr></table>
<dd align="center"><p align="center"><input type="button" name="Submit" value="看看你的成绩"onClick="Grade()" class="pt9"> </p>
</dd></dl>
</BODY>
</HTML>