请问如何将JavaScript写的倒记时代码加到下面的代码中
<% @ Page Language="C#" %><%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<Script runat="server">
string Lesson;
string No;
string Name;
OleDbDataReader dr;
void Page_Load(Object Src, EventArgs E) {
Lesson = Request["Lesson"];
No = Request["No"];
Name = Request["Name"];
string SQL = "Select * From " + Lesson + " Order By 题号";
OleDbConnection Conn;
建立新数据库联结Conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;"+
"Data Source="+Server.MapPath("test.mdb"));
Conn.Open();
//Response.Write(SQL);
OleDbCommand Comm = new OleDbCommand(SQL,Conn);
dr = Comm.ExecuteReader();
}
</Script>
<HTML>
<BODY BGCOLOR=BEIGE>
<CENTER>
<H1><FONT COLOR=#6699DD>在线考试系统</FONT></H1>
</CENTER>
<H2>考试科目 -- <%=Lesson%><HR></H2>
<FORM Action="Score.aspx" Method="GET">
<INPUT Type="Hidden"隐藏域 作为表单内容提交Name="Lesson" Value=<%=Lesson%>>
<INPUT Type="Hidden" Name="No" Value=<%=No%>>
<INPUT Type="Hidden" Name="Name" Value=<%=Name%>>
<%
string TestType = "";
while (dr.Read()){
Response.Write输出显示的内容("<B>" + dr["题号"].ToString() + "."
+ Server.HtmlEncode(dr["题目"].ToString())
+ dr["类型"].ToString() + ":" + dr["分数"].ToString() + "分)</B>");
Response.Write("<div>");
for (int i=1; i<5; i++) {
if (dr["类型"].ToString() == "单选") {
TestType = "Radio";
}
else {
TestType = "CheckBox";
}
Response.Write("<INPUT Type=" + TestType
+ " Name=No" + dr["题号"].ToString()
+ " Value=" + i +">"
+ Server.HtmlEncode(dr["选项" + i].ToString()) + "<BR>");
}
Response.Write("</div>");
}
%>
<INPUT Type=Submit 指定符号类型为提交按扭Value=" 交 卷 ">
</FORM><HR></BODY>
</HTML>
用JavaScript编的到记时
html>
<head>
<title>自动交卷</title>
<script language="Javascript">
var timer = 200; //在这里设定考试时间,单位为秒。
var startTime, timeOver
function checkTime()
{
var timeNow = new Date();
var remnantTime = timeOver.getTime() - timeNow.getTime();
if(remnantTime < 1)
{
alert("时间到了,点击确定交卷。");
document.myFrm.submit();
}
else
{
var msg = "";
remnantMinutes = Math.round(remnantTime/60000);
remnantSeconds = Math.round((remnantTime % 60000) / 1000)
if(remnantMinutes > 0 ) msg = remnantMinutes + "分钟";
msg += remnantSeconds + "秒";
label1.innerText = msg;
}
setTimeout("checkTime();",1000);
}
function window_load()
{
startTime = new Date();
timeOver = new Date()
timeOver.setTime(startTime.getTime() + (timer * 1000));
checkTime();
}
window.onload = window_load; //网页加载完成开始计时
</script>
</head>
<body>
离交卷还有:<span id="label1"></span>
<form name="myFrm" action="result.asp" style="border:1 solid #CCCCCC" title="这是试题的表单">
姓名:<input type="text" name="Name"><br>
考号:<input type="text" name="Number"><br>
<input type="submit" value="交卷">
</form>
</html>