?? exam_add.asp
字號:
<!-- #include file="cookies.asp" -->
<script language="JavaScript">
function check()
{
if(document.form1.ename.value == '') //課程名為空
{
window.alert('請輸入課程名稱');
document.form1.ename.focus();
return false;
}
if(document.form1.eid.value == '') //試題編號為空
{
window.alert('請輸入試題編號');
document.form1.eid.focus();
return false;
}
if(document.form1.text.value == '') //試卷名為空
{
window.alert('請輸入試卷名稱');
document.form1.text.focus();
return false;
}
if(document.form1.pro.value == '') //未選擇所屬專業
{
window.alert('請輸入所屬專業');
document.form1.pro.focus();
return false;
}
}
</script>
<!-- #include file="conn/conn.asp" -->
<html>
<head>
<title>出題</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body bgcolor="#EEEEEE" text="#000000">
<!-- #include file="button_t.asp" -->
<table width="760" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td><table width="760" border="0" align="center" bgcolor="#FFFFFF">
<form name="form1" method="post" action="exam_save.asp" onsubmit="return check();">
<tr>
<td> </td>
</tr>
<tr><td><p>專 業:
<% '動態顯示專業
set rstype=createobject("adodb.recordset")
sql="select * from profession order by id"
rstype.Open sql,conn,1,3%>
<select name="pro">
<option value="">請選擇</option>
<%do while not rstype.EOF%>
<option value="<%=rstype("name")%>"><%=rstype("name")%></option>
<%
rstype.MoveNext
loop
set rstype=nothing
%>
</select>
</p>
</td>
</tr>
<tr>
<td>課程名稱:
<input name="ename" type="text" size="50"> <font size="2"> </font>
</td>
</tr>
<tr>
<td>試題編號:
<input name="eid" type="text" size="4"> <font size="2"> (如1 ,必須為阿拉伯數字) </font>
</td>
</tr>
<tr>
<td>試卷名稱:
<input name="text" type="text" size="50"> <font size="2"> </font>
</td>
</tr>
<tr>
<td> <input type="submit" name="Submit" value="創建"> </td>
</tr>
</form>
</table>
<hr width="900">
<table width="750" border="0" align="center">
<tr>
<td bgcolor="#CCCCCC"><font color="#0000FF">【試卷管理】</font></td>
</tr>
<%
'分頁顯示記錄
if request("page")="" then
page="1"
else
page=request("page")
end if
set rs=server.createobject("adodb.recordset")
sql="select * from exam order by ename" '取多有試卷
rs.open sql,conn,1,1
if not rs.eof then
x=x+1
rs.pagesize=30
rs.Absolutepage=clng(page)
if cstr(page)=cstr(rs.PageCount) and (rs.RecordCount mod rs.PageSize <> 0) then
recend=rs.RecordCount mod rs.PageSize
else
recend=rs.PageSize
end if
if request("page")<>"" then
end if
%>
<tr>
<td>
<table width="900" border="0" cellpadding="4" cellspacing="0" align="center">
<tr>
<td><strong>試卷名稱</strong></td>
<td><strong>課程名稱</strong></td>
<td width="40"><strong>編號</strong></td>
<td width="200"><strong>所屬專業</strong></td>
<td width="100"><strong>加入時間</strong></td>
<td width="55"> </td>
<td width="45"> </td>
<td width="45"> </td>
</tr>
<%
for i=1 to recend
if i mod 2=1 then
color="#f8f8f8"
else
color="#E4e4e4"
end if
%>
<tr bgcolor="<%=color%>" valign="middle">
<td>
<% '判斷是否發布
if trim(rs("fabu"))="1" then%>
<a href="exam_view.asp?eid=<%=trim(rs("eid"))%>&ename=<%=trim(rs("ename"))%>&text=<%=trim(rs("text"))%>" target="_blank">
<%end if%>
<%=trim(rs("text"))%>
<%if trim(rs("fabu"))="1" then%>
(已發布)</a>
<%end if%>
</td>
<td>
<%=trim(rs("ename"))%>
</td>
<td width="40"><%=trim(rs("eid"))%></td>
<td width="200"><%=trim(rs("pname"))%></td>
<td width="100"><%=trim(rs("addtime"))%></td>
<td width="55">
<%if trim(rs("fabu"))="1" then%>
<input type="button" name="Submit" value="不發布" onclick="location.href='exam_fb.asp?eid=<%=trim(rs("eid"))%>&ename=<%=trim(rs("ename"))%>&fabu=2';">
<%else%>
<input type="button" name="Submit2" value="發布" onclick="location.href='exam_fb.asp?eid=<%=trim(rs("eid"))%>&ename=<%=trim(rs("ename"))%>&fabu=1';">
<%end if%>
</td>
<%if trim(rs("fabu"))="1" then%>
<td width="45"> </td>
<td width="45"> </td>
<%else%>
<td width="45">
<input type="button" name="Submit4" value="編輯" onclick="window.open('exam_edit.asp?eid=<%=trim(rs("eid"))%>&ename=<%=trim(rs("ename"))%>&text=<%=trim(rs("text"))%>','intr','menubar=no,toolbar=no,location=no,directories=no,status=yes,scrollbars=1,resizable=0,width=500,height=400,top=80,left=100');return false;">
</td>
<td width="45">
<input type="button" name="Submit3" value="刪除" onClick="window.open('exam_del.asp?eid=<%=trim(rs("eid"))%>&ename=<%=trim(rs("ename"))%>&text=<%=trim(rs("text"))%>','intr','menubar=no,toolbar=no,location=no,directories=no,status=yes,scrollbars=1,resizable=0,width=300,height=150,top=80,left=100');return false;">
</td>
<%end if%>
</tr>
<%
rs.movenext
next
%>
</table>
</td>
</tr>
</table>
<table border="0" width="760" align="center" bgcolor="<%=tablebgcolor_2%>">
<tr>
<td>
<div align="left"><font color="#000000">共有試卷記錄<%=rs.recordcount%>條</font></div>
</td>
<td width="40" align="center"> <font color="#000000">
<% if page="1" then %>
上頁
<%else%>
<a href=addexam.asp?page=<%=page-1%>>上頁</a>
<% end if %>
</font></td>
<td width="40" align="center"> <font color="#000000">
<% if page=cstr(rs.pagecount) then %>
下頁
<%else%>
<a href=addexam.asp?page=<%=page+1%>>下頁</a>
<% end if %>
</font>
<%
end if
rs.close
set rs=nothing
%></td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
<%
conn.close
set conn=nothing
%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -