⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 classxuanke.asp

📁 这是一个基于sql和asp的网页设计
💻 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">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
<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 + -