📄 test2.htm
字号:
<html>
<head>
<title>在线考试脚本(二)</title>
<style type="text/css">
<!--
body { font-family: "宋体"; font-size: 9pt; margin-top: 0px; margin-left: 0px; margin-right: 0px}
A { COLOR: black; FONT-SIZE: 13px; FONT-WEIGHT: 400; TEXT-DECORATION: none }
A:hover { COLOR: red; FONT-SIZE: 13px; FONT-WEIGHT: 400; TEXT-DECORATION: underline }
a:active { font: 9pt "宋体"; cursor: hand; color: #FF0033 }
-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="JavaScript">
var Total_Question = 4 // 修改这里与题目数量一致
var msg = ""
// 正确答案
var Solution = new Array(Total_Question)
Solution[0] = "TCP/IP"
Solution[1] = "集线器"
Solution[2] = "SUN"
Solution[3] = "Microsoft"
//
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='close' onclick=javascript:window.close()></BODY></HTML>"}
else {
msg = MustHave1 +Percent + "<font color='red'>正确答案:</font><p>" + msg + "<input type='button' value='close' 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>
</head>
<body bgcolor="#fef4d9">
<br>
<br>
<center><font color=red face="隶书" size=6>在线考试脚本(二)</font></center>
<br>
<br><center>
<table border=5 bordercolor=blue borderlight=green>
<tr><td align=center><font size=5 color=red face="Arial, Helvetica, sans-serif"><strong>下面框中为脚本显示区</strong></font></td></tr>
<tr><td align=center> <table width="75%" border="0" align="center">
<tr>
<td>
<form>
四个非常简单的问题:<p>
(1)Internet上使用的网络协议是:__________
<br>
<input type="radio" name="q1" value="0" checked>X.25
<input type="radio" name="q1" value="1">TCP/IP
<input type="radio" name="q1" value="0">NetBEUI
<br><br> </form>
<form>
(2)HUB是指:__________
<br>
<input type="radio" name="q1" value="0" checked>网桥
<input type="radio" name="q1" value="1">集线器
<input type="radio" name="q1" value="0">网关
<input type="radio" name="q1" value="0">路由器
<br><Br> </form>
<form>
(3)JAVA是哪个公司的产品:__________
<br>
<input type="radio" name="q1" value="0" checked>Novell
<input type="radio" name="q1" value="0">Microsoft
<input type="radio" name="q1" value="1">SUN
<br><Br> </form>
<form>
(4)IIS(Internet Information Server)是哪个公司的产品:__________
<br>
<input type="radio" name="q1" value="0" checked>Novell
<input type="radio" name="q1" value="1">Microsoft
<input type="radio" name="q1" value="0">Netscape
<br><Br> </form>
<form>
<div align="center">
<input type="button" name="Submit" value="看看成绩"
onClick="Grade()" class="pt9">
</div>
</form>
</td>
</tr>
</table></td></tr></table></center>
<br>
<br>
<center>
<textarea name=source rows=12 cols=55 class=yk9>
脚本说明:
第一步:把如下代码加入<head>区域中
<script language="JavaScript">
var Total_Question = 4 // 修改这里与题目数量一致
var msg = ""
// 正确答案
var Solution = new Array(Total_Question)
Solution[0] = "TCP/IP"
Solution[1] = "集线器"
Solution[2] = "SUN"
Solution[3] = "Microsoft"
//
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='close' onclick=javascript:window.close()></BODY></HTML>"}
else {
msg = MustHave1 +Percent + "<font color='red'>正确答案:</font><p>" + msg + "<input type='button' value='close' 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>
第二步:把如下代码加入<body>区域中
<table width="75%" border="0" align="center">
<tr>
<td>
<form>
三个非常简单的问题:<p>
(1)Internet上使用的网络协议是:__________
<br>
<input type="radio" name="q1" value="0" checked>X.25
<input type="radio" name="q1" value="1">TCP/IP
<input type="radio" name="q1" value="0">NetBEUI
<br><br> </form>
<form>
(2)HUB是指:__________
<br>
<input type="radio" name="q1" value="0" checked>网桥
<input type="radio" name="q1" value="1">集线器
<input type="radio" name="q1" value="0">网关
<input type="radio" name="q1" value="0">路由器
<br><Br> </form>
<form>
(3)JAVA是哪个公司的产品:__________
<br>
<input type="radio" name="q1" value="0" checked>Novell
<input type="radio" name="q1" value="0">Microsoft
<input type="radio" name="q1" value="1">SUN
<br><Br> </form>
<form>
(4)IIS(Internet Information Server)是哪个公司的产品:__________
<br>
<input type="radio" name="q1" value="0" checked>Novell
<input type="radio" name="q1" value="1">Microsoft
<input type="radio" name="q1" value="0">Netscape
<br><Br> </form>
<form>
<div align="center">
<input type="button" name="Submit" value="看看成绩"
onClick="Grade()" class="pt9">
</div>
</form>
</td>
</tr>
</table>
</textarea>
<SCRIPT LANGUAGE="JavaScript">
<!-- hide
function goHist(a)
{
history.go(a);
}
//-->
</script>
<FORM METHOD="post">
<INPUT TYPE="button" VALUE="返回" onClick="goHist(-1)" style="background-color: #8000FF; color: rgb(255,255,255)">
</form>
</center>
<br>
<br>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -