www.gusucode.com > ASP毕业设计在线考试管理系统源码 > ASP毕业设计在线考试管理系统源码\code\admin\question_admin.asp

    <!--#include file="db.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>在线考试系统</title>
<script language="javascript">
function editit(id)
{ 
  page="question_edit.asp?id="+id
  window.open (page,'查看编辑题目','width=560,height=460')
}



function viewit(myform)
{
if (document.viewaddform.subjectview.value!="")
  subject=document.viewaddform.subjectview.value;
else
  subject="所有";
if (document.viewaddform.typeadd.value!="")
  type=document.viewaddform.typeadd.value;
else
  type="所有";
result="浏览<"+subject+">题库中<"+type+">题目?"
if (confirm(result))
  {
    myform.action="question_admin.asp";
    myform.submit();
  }
}


function addit(myform)
{
if (document.viewaddform.subjectview.value!="" & document.viewaddform.typeadd.value!=""){
  result="添加"+document.viewaddform.typeadd.value+"题目到"+document.viewaddform.subjectview.value+"题库?"
  if (confirm(result))
  {
    myform.action="question_add.asp";
    myform.submit();
  }
}
else
alert("请首先选择科目和题目类型!")
}
function delit(){
if (confirm("是否从题库中删除所选项?"))return true;
else return false; }
</script>
<link href="../Style.css" rel="stylesheet" type="text/css">
</head>
<body>
<table border="0" cellspacing="0"  bordercolor="#111111" width="100%" height="25">
  <tr>
    <td width="100%">当前位置:在线考试系统 -&gt; 题库管理
    <hr></td>
  </tr>
</table>
<table border="0" cellpadding="2" cellspacing="0"  bgcolor="#99CCFF" width="100%">
  <form name="viewaddform" method="POST" action="question_admin.asp">
    <tr>
      <td bgcolor="#E6F7FF"><select name="subjectview" size="1" class="smallInput">
      <option selected>--选择科目--</option>
      <% sql="select * from subject"
      set rs=server.createobject("adodb.recordset")
      rs.open sql,conn,3,2
      do while not rs.eof %>
      <option value="<%=rs("subject")%>"><%=rs("subject")%></option>
      <% rs.movenext
      loop
      rs.close %></select><select name="typeadd" size="1" class="smallInput">
      <option selected>--题型--</option>
      <option value="单选题">单选题</option>
      <option value="多选题">多选题</option>
      <option value="判断题">判断题</option>
      </select><input type="submit" value="浏 览" name="I3" onClick="viewit(this.form)" class="smallInput">
      <input type="submit" value="添加题目" name="I6" onClick="addit(viewaddform)" class="smallInput"></td>
    </tr>
  </form>
</table>
<form name="viewdatabase" method="post" action="question_del.asp"  onsubmit = "return delit()">
<table border="0" cellpadding="0" cellspacing="0"  bordercolor="#111111" width="100%" id="AutoNumber4" height="30">
  <tr>
    <td>
    <p align="right">
    <input type="submit" value="删除所选项" name="I3" class="smallInput">
    </td>
  </tr>
</table>
<table width="100%" border="0" cellpadding="5" cellspacing="1" bgcolor="#5A8BCE" id="AutoNumber1" style="border-collapse: collapse">
  <tr bgcolor="#E6F7FF">
    <td width="30" height="20" align="center"> </td>
    <td width="30" align="center"><b>序号</b></td>
    <td width="120" align="left" bgcolor="#E6F7FF">
    <p align="center">&nbsp;<b>科目名称</b></td>
    <td align="left" bgcolor="#E6F7FF">
    <p align="center"><b>题目内容</b></td>
    <td width="30" align="left">
    <p align="center"><b>操作</b></td>
  </tr>
  <% 
subjectview=request("subjectview")
typeadd=request("typeadd")
mykey=request("mykey")
if subjectview="--选择科目--" or subjectview="" then
  subjectview="%"
end if
if typeadd="--题型--" or typeadd="" then
  typeadd="%"
end if
if mykey= "--关键字--" or mykey="" then
  mykey="%"
end if

sql="select * from question where subject like '"& subjectview &"' and type like '"& typeadd &"' and question like '" & mykey &"'"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,3,2
on error resume next
rs.PageSize = 10
Page = CLng(Request("Page"))
If Page < 1 Then Page = 1
If Page > rs.PageCount Then Page = rs.PageCount
i=page+(page-1)*9
rs.AbsolutePage = Page
For iPage = 1 To rs.PageSize
%>
  <tr>
    <td align="center" bgcolor="#E6F7FF">
      <input type="checkbox" name="id" value="<%=rs("id")%>"></td>
    <td align="center" bgcolor="#FFFFFF"><%=i%> </td>
    <td align="left" bgcolor="#FFFFFF"><%=rs("subject")%></td>
    <td align="left" bgcolor="#FFFFFF"><%=rs("question")%> </td>
    <td align="left" bgcolor="#FFFFFF">
    <p align="center" class="style1"><a href="javascript:editit(<%=rs("id")%>)">
    查看/编辑</a></td>
  </tr>
  <% 
rs.MoveNext
If rs.EOF Then Exit For
i=i+1
Next
%>
  <caption></caption>
</table>
</form>
<div ALIGN="right">
  <table>
    <form ACTION="<%=Myself%>?sujectview=<%=subjectview%>&typeadd=<%=typeadd%>&mykey=<%=mykey%>%&gt;" METHOD="GET">
      <tr>
        <td>
        <p ALIGN="right"><%If Page <> 1 Then ' 如果不是位于第一页%>
        <a href="<%=Myself%>?Page=1&sujectview=<%=subjectview%>&typeadd=<%=typeadd%>&mykey=<%=mykey%>">
        第一页</a>
        <a HREF="<%=Myself%>?Page=<%=(Page-1)%>&sujectview=<%=subjectview%>&typeadd=<%=typeadd%>&mykey=<%=mykey%>">
        上一页</a>
        <%                                      
End If                                         
If Page <> rs.PageCount Then ' 如果不是位于最后一页                                         
%> <a HREF="<%=Myself%>?Page=<%=(Page+1)%>&sujectview=<%=subjectview%>&typeadd=<%=typeadd%>&mykey=<%=mykey%>">
        下一页</a>
        <a HREF="<%=Myself%>?Page=<%=rs.PageCount%>&sujectview=<%=subjectview%>&typeadd=<%=typeadd%>&mykey=<%=mykey%>">
        最后一页</a> <% End If %> <font SIZE="2">输入页次:</font><input NAME="Page" SIZE="3" CLASS="s01">
        <font SIZE="2">页次:</font><font COLOR="Red" SIZE="2"><%=Page%>/<%=rs.PageCount%></font></p>
        <p> </td>
      </tr>
    </form>
  </table>
</div>
</div>
</td>
</tr>
</table>

</body>

</html>