?? classxuanke.asp
字號:
<!--#include file="connectionstring.asp"-->
<%
'驗證合法性,保證已經驗證通過密碼與班組代碼。
IdClass=request.cookies("IdClass")
if IdClass="" then
response.write "非法操作!"
response.end
end if
%>
<%
'取得班級全稱(memo)。
Set Conn=Server.CreateObject("ADODB.Connection")
Conn.Open strConn
sql="select * from classid where id='"&IdClass&"'"
rs=conn.Execute (sql)
memo = rs("memo")
ShouldNum=rs("num")
set rs = nothing
%>
<%
'取得允許預約實驗的周次(TIMEA)和允許預約的個數
sql = "select * from status"
set relist = conn.execute(sql)
timea=relist("time")
'本段時間允許預約實驗個數(tnum)。
tnum=relist("tnum")
'時間段的起始周和結束周。
StartZhou = left(timea,2)
EndZhou = right(timea,2)
%>
<%
'用cookies保存,下一網頁要用。
response.Cookies("tnumber")=tnum
response.cookies("timea")=timea
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
function window_onload() {
var i;
for (i=0;i< xuanke.SelectTime.length ;i++){
document.xuanke.SelectTime(i).style.display = "none";
}
}
function IdCourse_onClick() {
var i,j;
for (i=0;i< xuanke.SelectTime.length ;i++) {
document.xuanke.SelectTime(i).style.display = "none";
if (document.xuanke.IdCourse(i).checked) j=i;
};
document.xuanke.SelectTime(j).style.display = "";
//alert(document.xuanke.IdCourse(j).value);
return true;
}
function xuanke_onsubmit() {
var i;
for (i=0;i< xuanke.SelectTime.length ;i++){
if (xuanke.IdCourse(i).checked) return true;
};
alert("請先選擇好實驗!");
return false;
}
//-->
</SCRIPT>
</head>
<body background="Back1.jpg" link="#0000FF" vlink="#0000FF" alink="#FF0000" LANGUAGE=javascript onload="return window_onload()">
<font SIZE="1" COLOR="#800000">
</font>
<p></p>
<p style="margin-bottom: 0"><font color="#FF0000" size="4"><b><%=memo%></b></font>班:<font size="3" color="#008080">你班
應該完成 <b> <font color="#FF0000" size="4"> <%=ShouldNum%> </font></b>個</font><font size="3" color="#008080">實驗,
現在可以預約第
<font color="#FF0000" size="6"><b><%=StartZhou%></b></font> 周到
<font color="#FF0000" size="6"><b><%=EndZhou%></b></font> 周的實驗。在這個時間段內,每個組最多可以預約
<font color="#FF0000" size="6"><b><%=tnum%></b></font> 個實驗。</p>
<hr color="#008080">
<form method="POST" action="ClassXuankeTime.asp" name="xuanke" onsubmit="return xuanke_onsubmit()">
<p style="margin-top: 0; margin-bottom: 10" align="center">請為 </font><font size="3" color="#FF0000">
<select size="1" name="Group" style="color: #FF0000; font-size: 14pt; font-weight: bold">
<option selected>A</option>
<option>B</option>
</select>
</font><font size="3" color="#008080"> 組選擇實驗項目:
<table border="1" width="100%" height="44">
<tr>
<td width="20%" align="center" height="22"><font color="#000080">(1)選擇實驗</font></td>
<font size="3" color="#008080">
<td width="46%" align="center" height="22"><font color="#000080">實驗名稱</font></font></td>
<td width="16%" align="center" height="22">(2)選擇時間</td>
<td width="14%" align="center" height="22"><font color="#000080">教室</font></td>
</tr>
<%
'從course.cour兩個表中讀取數據,
'course表為了列出所有的實驗項目,
'但是在讀取cour表的時候
'如果發現當前時間段的實驗項目不滿足表status中的條件,該實驗項目將不會顯示出來
'這將由語句 if not tmpRs.eof then 來控制
sql = "select * from course order by name"
set relist = conn.execute(sql)
set tConn = server.CreateObject("adodb.connection")
tConn.Open strConn
'bExist來判定下面的搜索是否有結果,如果沒有紀錄的話,就不會出現提交按鈕
bExist = false
while not relist.eof
IdCourse=relist("id")
tmpSql = "select time from cour where num=0 and id='" & IdCourse & "' and left(time,2) <=" & EndZhou & " and left(time,2) >= " & StartZhou
set tmpRs = tConn.Execute(tmpSql)
if not tmpRs.eof then
bExist = true
%>
<tr>
<td width="14%" height="22" align="center">
<input type="radio" value="<%=IdCourse%>" name="IdCourse" id=IdCourse LANGUAGE=javascript onClick="return IdCourse_onClick()">
<input type="hidden" value="<%=IdCourse%>" name="hid" readonly>
</td>
<td width="50%" height="22" align="center"><%=relist("NAME")%></td>
<td width="16%" height="22" align="center">
<select name="SelectTime" size="1">
<%
while not tmpRs.eof
tmpTime = tmpRs("time")
ltmpTime = left(tmpTime,2)
outText = "<option value=" & tmpTime & ">第" & ltmpTime & "周,星期"
outText = outText & mid(tmpTime,3,1) & "," & mid(tmpTime,4) & "</option>"
Response.Write outText
tmpRs.movenext
wend
tmpRs.close
set tmpRs=nothing
%>
</select>
</td>
<td width="14%" height="22" align="center"><%=relist("ROOM")%>室</td>
<%
end if
relist.movenext
wend
set relist = nothing
conn.Close
set conn = nothing
%> </tr>
</table>
<p align="center">
<%
if bExist then
%>
第
<font color="#FF0000" size="6"><b><%=StartZhou%></b></font> 周到
<font color="#FF0000" size="6"><b><%=EndZhou%></b></font> 周的實驗
<input type="submit" value="項目和時間選好了!" name="B1">
<input type="button" value="我不想預約了" onClick="history.back()">
<%
else
Response.Write "<center><font color=red><h3>對不起,本段時間內沒有適合的實驗供您選擇!</h3></font></center>"
end if
%>
</form>
</font>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -