<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>随机点名系统V2.0—点名</title>
<link href="../css/black.css" rel="stylesheet" type="text/css" />
<script src="../script/navigate.js" type="text/javascript"></script>
<script src="../script/XMLOperate.js" type="text/javascript"></script>
<script language="javascript">
//手动点名控制
function manualControl()
{
if(document.getElementById("manual").checked)
{document.getElementById("studentID").disabled = false;}
else
{document.getElementById("studentID").disabled = true;}
}
//随机点名
function rollCall()
{
xmlDoc = loadXMLDoc("../script/students.xml"); //载入XML文档
var student; //定义学生对象变量
//按手动和自动两种情况点名
if(document.getElementById("manual").checked)
{
var stuid = document.getElementById("studentID").value;
student = getStudentByID(xmlDoc,stuid); //根据学号获取学生信息
}
else
{
//获取下拉选择框的值
var x = document.getElementById("studentClass")
var xValue = x.options[x.selectedIndex].text;
var studentList = getStudents(xmlDoc,"B","class",xValue);;//学生列表
//获取学生列表
var num = studentList.length; //获取数组中元素数量
//随机获取索引值,因为index从0开始所以再减1
var renderID = Math.ceil(Math.random() * num) - 1;
student = studentList[renderID]; //获取选中的学生对象
}
//输出学生姓名
document.getElementById("studentName").innerText = student.name;
//将选中的学生信息输出到页面
document.getElementById("txtID").value = student.studentID;
document.getElementById("txtName").value = student.name;
document.getElementById("txtClass").value = student.studentClass;
document.getElementById("txtOrderID").value = student.orderID;
document.getElementById("txtScore").value = student.score;
document.getElementById("txtTimes").value = student.times;
document.getElementById("photo").src = student.photo;
}
//获取单选按钮的值
function check(radioValue)
{
document.getElementById("answerValue").value=radioValue;
}
//保存XML文件
function saveXML()
{
//判断学号输入框的值是否为空
if(document.getElementById("txtID").value=="")
{alert("请先抽取学生。");}
else
{
//获取需要修改的学生学号
var stuid = document.getElementById("txtID").value;
//获取需要增加的分数
var scorePlus = document.getElementById("answerValue").value;
//document.getElementById("updateXML").href = "XMLSave.hta#" + stuid + "#" +scorePlus ;
window.open("XMLSave.hta#" + stuid + "#" +scorePlus ,"_blank","width=400, height=200");
//alert("XMLSave.hta#" + stuid + "#" +scorePlus );
}
}
</script>
</head>
<body>
<div id="top">
<table width="100%">
<tr>
<td width="171"><img src="../imges/logo.jpeg" height="100px"/></td>
<td id="title">随机点名系统 v2.0<td>
</tr>
</table>
</div>
<div id="menu">
<script language="javascript">showMenu();</script>
</div>
<div id="main">
<fieldset>
<form>
<span id="classSelect">选择班级:
<select id="studentClass" >
<option value="50">计本0504</option>
<option selected="selected" value="172">计升07</option>
<option value="37">计升0701</option>
<option value="36">计升0702</option>
<option value="49">计升0703</option>
<option value="51">计升0704</option>
<option value="49">软件0601</option>
</select>
<input id="balance" type="checkbox" checked="checked"/>均衡控制
<input id="manual" type="checkbox" onclick="manualControl()"/>手动点名
<input id="studentID" type="text" disabled="disabled" value="请输入学号"/>
<input type="button" id="rollButton" onclick="rollCall()" value="开始抽取" />
</span>
<hr/>
<table width="100%">
<tr>
<td width="50%" align="center">
<img src="../photos/default.jpg" height="300px" id="photo" />
</td>
<td valign="top" align="center">
<h1>请 【<span id="studentName"></span>】 同学回答问题</h1>
学生学号:
<input type="text" id="txtID" value="" /><br/><br/>
学生姓名:
<input type="text" id="txtName" value="" /><br/><br/>
所在班级:
<input type="text" id="txtClass" value="" /><br/><br/>
班内序号:
<input type="text" id="txtOrderID" value="" /><br/><br/>
累计积分:
<input type="text" id="txtScore" value="" /><br/><br/>
累计次数:
<input type="text" id="txtTimes" value="" /><br/><br/>
<input type="radio" onclick="check(this.value)"
checked="checked" name="answer" value="1" />回答
<input type="radio" onclick="check(this.value)" name="answer" value="0" />未答
<input type="radio" onclick="check(this.value)" name="answer" value="-1" />缺勤
<input type="hidden" id="answerValue" value="1" />
<input type="button" id="upDate" onclick="saveXML()" value="更 新" />
</td>
</tr>
</table>
</form>
</fieldset>
</div>
<div id="bottom">
<br/>
<script language="javascript">showMenu()</script>
<hr/>
<script language="javascript">showCopyright()</script>
</div>
</body>
</html>