scorestatics.asp
来自「网络考试系统最终备份」· ASP 代码 · 共 457 行
ASP
457 行
<!--#include file="conn.inc"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新建网页 1</title>
<script language="javascript">
function ScorePassinfo(PID,score,pas)
{
page="conditionScoreDisplay.asp?test_id="+PID+"&maxScore="+score+"&pass="+pas;
window.open (page,'查看考试信息','width=500,height=470')
}
function analysis(myform)
{
str= myform.rangeScore.value;
// var a = str.match(/^(\d{1,2})(:)?(\d{1,2})\2(\d{1,2})$/);
var a = str.match(/^\d+$/)
if(a != null)
{
myform.action="scorestatics.asp";
return true;
}
else
{
alert("请输入正确的分数区间间隔,不能为负");
myform.rangeScore.value ="";
return false;
}
}
</script>
<link rel="stylesheet" type="text/css" href="css.css">
<%
v_PaperID = request("radioPaperID")
v_RangeScore = request("rangeScore")
sql="select * from paper_info where PaperID="&v_PaperID
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,3,2
v_Totalscore = rs("TotalPer")
v_PKnowID =rs("PKnow_ID")
rs.close
set rs = nothing
sql = "select count(*) as total from test_user where isTest = 1 and Paper_ID="&v_PaperID
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,3,2
v_totalPeple = rs("total")
rs.close
set rs = nothing
%>
<style type="text/css">
<!--
.style1 {
color: #FF0000;
font-weight: bold;
}
-->
</style>
</head>
<%
REM 首先我们设计一个ShowCart函数,其中
REM aValues 是一个数值数组
REM aLables 是横坐标的标号
REM strTitle是这个统计图的标题
REM strXAxisLable X轴的标签
REM strYAxisLable Y轴的标签
Sub ShowChart(ByRef aValues, ByRef aLabels, ByRef strTitle, ByRef strXAxisLabel, ByRef strYAxisLabel)
' 你可以随便改变的图形常数
' 单位是屏幕像素点
Const GRAPH_WIDTH = 450 ' 图形宽度
Const GRAPH_HEIGHT = 250 ' 图形
Const GRAPH_BORDER = 2 ' 坐标线宽度
Const GRAPH_SPACER = 2 ' 统计条之间的距离
Const TABLE_BORDER = 0
' 变量声明
Dim I
Dim iMaxValue
Dim iBarWidth
Dim iBarHeight
' 取得aValues最大值
iMaxValue = 1
aValues = SPLIT(aValues,",")
aLabels = SPLIT(aLabels,",")
For I = 0 To UBound(aValues)
If iMaxValue < aValues(I) Then iMaxValue = aValues(I)
Next 'I
if iMaxValue = 0 then
iMaxValue = 100
end if
iMaxValue = 100
' 计算每条图形的宽度
iBarWidth = (GRAPH_WIDTH \ (UBound(aValues) + 1)) - GRAPH_SPACER
' 开始绘图
%>
<TABLE BORDER='<%= TABLE_BORDER %>' CELLSPACING='0' CELLPADDING='0'>
<TR>
<TD COLSPAN='3' ALIGN='center'><H2>
<%
Response.Write "<BR>" & vbCrLf
Response.Write "<BR>" & vbCrLf
Response.Write "<BR>" & vbCrLf
%>
<%= strTitle %></H2></TD>
</TR>
<TR>
<TD VALIGN='center'><B><%= strYAxisLabel %></B></TD>
<TD VALIGN='top'>
<TABLE BORDER='<%= TABLE_BORDER %>' CELLSPACING='0' CELLPADDING='0'>
<TR>
<TD ROWSPAN='2'><IMG SRC='./images/spacer.gif' BORDER='0' WIDTH='1' HEIGHT='<%= GRAPH_HEIGHT %>'></TD>
<TD VALIGN='top' ALIGN='right'><%= iMaxValue %>% </TD>
</TR>
<TR>
<TD VALIGN='bottom' ALIGN='right'>0% </TD>
</TR>
</TABLE>
</TD>
<TD>
<TABLE BORDER='<%= TABLE_BORDER %>' CELLSPACING='0' CELLPADDING='0'>
<TR>
<TD VALIGN='bottom'><IMG SRC='1.gif' BORDER='0' WIDTH='<%= GRAPH_BORDER %>' HEIGHT='<%= GRAPH_HEIGHT %>'></TD>
<%
' 对数组所有数值进行循环,绘制条形图!
For I = 0 To UBound(aValues)
iBarHeight = Int((aValues(I) / iMaxValue) * GRAPH_HEIGHT)
' 因为浏览器会忽略0高度的条形图,所以用1代替!
If iBarHeight = 0 Then iBarHeight = 2
%>
<TD VALIGN='bottom'><IMG SRC='1.gif' BORDER='0' WIDTH='<%= GRAPH_SPACER %>' HEIGHT='1'></TD>
<TD VALIGN='bottom'><IMG SRC='1.gif' BORDER='0' WIDTH='<%= iBarWidth %>' HEIGHT='<%= iBarHeight %>' ALT='<%= aValues(I) %>'></A></TD>
<%
Next 'I
%>
</TR>
<TR>
<TD COLSPAN='<%= (2 * (UBound(aValues) + 1)) + 1 %>'><IMG SRC='./images/spacer_black.gif' BORDER='0' WIDTH='<%= GRAPH_BORDER + ((UBound(aValues) + 1) * (iBarWidth + GRAPH_SPACER)) %>' HEIGHT='<%= GRAPH_BORDER %>'></TD>
</TR>
<% ' 检查横坐标数组是否有效! %>
<% If IsArray(aLabels) Then %>
<TR>
<TD><!-- 留点空间 --></TD>
<% For I = 0 To UBound(aValues) %>
<TD><!-- 留点空间 --></TD>
<TD ALIGN='center'><FONT SIZE='1'><%= aLabels(I) %></FONT></TD>
<% Next 'I %>
</TR>
<% End If %>
</TABLE>
</TD>
</TR>
<TR>
<TD COLSPAN='2'><!-- 使下一个TD元素居中--></TD>
<TD ALIGN='center'><BR><B><%= strXAxisLabel %></B></TD>
</TR>
</TABLE>
<%
End Sub
%>
<body>
<table border="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber2" height="25">
<tr>
<td width="100%">当前位置:<a href="news.asp">系统管理</a> > <a href="adminremarkpaper.asp">评卷管理</a> > 试卷分析</td>
</tr>
</table>
<p>
<form name="staticMethod" action="scorestatics.asp" method="post">
<table border="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber2" height="25">
<tr>
<td width="16%">试卷编号:<%=v_PaperID%> <input name="radioPaperID" type="hidden" id="radioPaperID" value="<%=v_PaperID%>"></td>
<td width="22%">参考人数:<%=v_totalPeple%></td>
<td width="62%"> <input type="radio" name="sta_method" value=0 onClick=" submit()"
<%if request("sta_method")="" or request("sta_method") =0 then %>
checked
<%
end if
%>
>
按分数区间分析
<input type="radio" name="sta_method" value=1 onClick=" submit()"
<%if request("sta_method")=1 then %>
checked
<%
end if
%>>
按知识点分析</td>
</tr>
</table>
</form>
</p>
<%if request("sta_method")="" or request("sta_method") =0 then %>
<table border="1" cellpadding="0" cellspacing="1" style="border-collapse: collapse" bordercolor="#C0C0C0" width="100%" id="AutoNumber3" height="20">
<form method="POST" name="form1" onSubmit="return submit();">
<input name="radioPaperID" type="hidden" value="<%=v_PaperID%>">
<tr>
<td width="120" bgcolor="#E1E1E1">
<p align="center">区间间隔</td>
<td> <p align="left">
<input name="rangeScore" type="text" class="inputnormal" id="rangeScore" onFocus="this.className='inputedit';this.select()" onBlur="this.className='inputnormal'" size="15">
注:只能为正整数 如:10,20,30 等</td>
<td width="59">
<p align="center">
<input border="0" value="分 析" name="I1" type="submit" onClick="analysis(this.form)" class="s02"></td>
</tr>
</form>
</table>
<form name="adminsubject" method="get" onSubmit="return submitit(this)">
<table border="1" cellpadding="0" cellspacing="1" style="border-collapse: collapse" bordercolor="#C0C0C0" width="100%" id="AutoNumber1">
<tr>
<td width="42" align="center" bgcolor="#E1E1E1" height="20"><b>序号</b> </td>
<td colspan="3" align="center" bgcolor="#E1E1E1">
分数区间</td>
<td width="330" align="left" bgcolor="#E1E1E1"><div align="center">通过人数</div></td>
<td width="199" align="left" bgcolor="#E1E1E1"><div align="center">未通过人数</div></td>
<td width="133" align="left" bgcolor="#E1E1E1"><div align="center">通过率</div></td>
</tr>
<%
if v_RangeScore <> "" then
v_RangeScore = trim(v_RangeScore)
'根据区间间隔确定应该分成多少个区间
n = v_Totalscore\v_RangeScore
m = v_Totalscore mod v_RangeScore
if m <> 0 then
n = n+ 1
end if
Y =""
X=""
for i = 1 to n
%>
<tr>
<td nowrap align="center" bgcolor="#E1E1E1"><%=i%> </td>
<td nowrap width="58" align="left">
<strong>
<%
startScore=(i-1)*v_RangeScore
response.Write(startScore)
%>
</strong> </td>
<td nowrap width="87" align="left"><div align="center">至</div></td>
<td nowrap >
<strong>
<%
endScore =i*v_RangeScore
if endScore > v_Totalscore then
endScore = v_Totalscore
end if
response.Write(endScore)
%>
</strong> 分</td>
<td nowrap align="left">
<a href="javascript:ScorePassinfo(<%=v_PaperID%>,<%=startScore%>,1)">
<%
sql1 = "select count(*) as passN from student_score where Paper_ID = "&v_PaperID&" and Score > "&startScore&""
set rs1 = server.CreateObject("adodb.recordset")
rs1.open sql1,conn,3,2
v_passN=0
v_passN = rs1("passN")
if v_passN >= v_totalPeple then
v_passN = v_totalPeple
end if
response.Write(v_passN)
%>
</a>人</td>
<td nowrap align="left"> <a href="javascript:ScorePassinfo(<%=v_PaperID%>,<%=startScore%>,0)">
<%
if v_totalPeple = 0 then
response.Write("0")
else
response.Write(v_totalPeple - v_passN)
end if
%>
</a>人</td>
<td nowrap align="left">
<%
passrate = 0
if v_totalPeple = 0 then
response.Write("0%")
else
passrate=v_passN/v_totalPeple *100
response.Write(v_passN/v_totalPeple *100 &"%")
end if
Y = Y + ""&passrate&""+","
X = X +""&startScore&"—"&endScore&""+","
%>
</td>
</tr>
<%
next
end if
conn.close
set conn = nothing
Y = TRIM(Y)
X = TRIM(X)
YL = LEN(Y)-1
XL = LEN(X)-1
IF XL > 0 OR YL > 0 THEN
Y = LEFT(Y,YL)
X = LEFT(X,XL)
IF v_RangeScore <=20 and v_RangeScore >=5 THEN
ShowChart Y, X, "成绩按分数统计通过率", "X 分数段", "Y 通过比例"
END IF
END IF
%>
<caption>
</caption>
</table>
</form>
<%else%>
<form name="adminsubject" method="get" onSubmit="return submitit(this)">
<table border="1" cellpadding="0" cellspacing="1" style="border-collapse: collapse" bordercolor="#C0C0C0" width="100%" id="AutoNumber1">
<tr>
<td width="42" align="center" bgcolor="#E1E1E1" height="20"><b>序号</b> </td>
<td width="258" align="center" bgcolor="#E1E1E1"> 知识点</td>
<td width="354" align="left" bgcolor="#E1E1E1"><div align="center">通过人数</div></td>
<td width="199" align="left" bgcolor="#E1E1E1"><div align="center">未通过人数</div></td>
<td width="133" align="left" bgcolor="#E1E1E1"><div align="center">通过率</div></td>
</tr>
<%
v_PKnowID = split(v_PKnowID,",")
n = ubound(v_PKnowID)
Y = ""
X = ""
for i = 1 to n
vknowid = trim(v_PKnowID(i))
sql = "select * from knowledge_info where KnowID ="&vknowid
set rs = server.CreateObject("adodb.recordset")
rs.open sql,conn,3,2
knowName = rs("KnowName")
knowid = rs("KnowID")
rs.close
set rs = nothing
'sql = "select count(*) as unPass from stu_error_question where err_Que_ID IN (select QueID from question_database where Knowledge_ID = "&vknowid&" and QueID in (select Err_Que_ID from stu_error_question where Paper_ID = "&v_PaperID&" )) "
'set rs = server.CreateObject("adodb.recordset")
'rs.open sql,conn,3,2
'v_unpass = rs("unPass")
'rs.close
'set rs = nothing
v_unpass=0
sql = "select User_ID FROM stu_error_question where Err_Que_ID in (select QueID from question_database where QueID in (select Err_Que_ID from stu_error_question where Paper_ID = "&v_PaperID&" ) and Knowledge_ID = "&vknowid&" )group by User_ID"
set rs = server.CreateObject("adodb.recordset")
rs.open sql,conn,3,2
while not rs.eof
v_unpass = v_unpass + 1
rs.movenext
wend
rs.close
set rs = nothing
sql = "select count(User_ID) AS totalPeple from test_user where Paper_ID = "&v_PaperID&" AND istest = 1"
set rs = server.CreateObject("adodb.recordset")
rs.open sql,conn,3,2
v_total =rs ("totalPeple")
rs.close
set rs = nothing
%>
<tr>
<td nowrap align="center" bgcolor="#E1E1E1"><%=i%> </td>
<td align="left" nowrap><%=knowName%><%=knowid%></td>
<td nowrap align="left"> <a href="javascript:ScorePassinfo(<%=v_PaperID%>,<%=startScore%>,1)"> </a>
<%
v_pass = v_total - v_unpass
if v_pass <0 then
v_pass = 0
end if
response.Write(v_pass)
%>
人</td>
<td nowrap align="left"> <a href="javascript:ScorePassinfo(<%=v_PaperID%>,<%=startScore%>,0)"> </a><%=v_unpass%>人</td>
<td nowrap align="left">
<%
if v_pass < 0 or v_total <=0 then
passRate = 0
else
passRate = v_pass/v_total * 100
end if
response.Write(passRate)
%>
% </td>
</tr>
<%
next
conn.close
set conn = nothing
%>
<caption>
</caption>
</table>
</form>
<%end if%>
<p>注:1.点击<span class="style1">通 过 人数</span> 查看<em><strong>哪些人</strong></em>通过 </p>
<p>
2.点击<span class="style1">未通过人数 </span>查看<em><strong>哪些人未</strong></em>通过</p>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?