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

📄 que_edit.asp

📁 本人的课程设计。不足之处请大家指教。因为第一次用ASP有很多不足的地方。
💻 ASP
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!-- #include file="cookies.asp" -->
<!-- #include file="conn/conn.asp" -->

<!-- #include file="conn/conn.asp" -->
<script language="JavaScript">
function check()
{

if(document.form1.qname.value == '')
        {
                window.alert('请输入题目名称');                
				document.form1.qname.focus();
				return false;			
        }
if(document.form1.key1.value == '' )
        {
                window.alert('请输入可选项A');                
				document.form1.key1.focus();
				return false;			
        }
if(document.form1.key2.value == '')
        {
                window.alert('请输入可选项B');                
				document.form1.key2.focus();
				return false;
        }
if(document.form1.key3.value == '' )
        {
                window.alert('请输入可选项C');                
				document.form1.key3.focus();
				return false;			
        }
if(document.form1.key4.value == '')
        {
                window.alert('请输入可选项D');                
				document.form1.key4.focus();
				return false;
        }
if(!(document.form1.rightkey[0].checked||document.form1.rightkey[1].checked||document.form1.rightkey[2].checked||document.form1.rightkey[3].checked||document.form1.rightkey[4].checked||document.form1.rightkey[5].checked||document.form1.rightkey[6].checked))
        {
                window.alert('请选择标准答案');                
				return false;
        }
}
</script>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="../css/style.css" type="text/css">
<title>网上考试系统 - 编辑题目</title>
<style type="text/css">
<!--
body {
	background-color: #0099FF;
}
-->
</style></head>
<body>
<table width="100%" border="0" bgcolor=#ffffff>
  <tr> 
    <td><font color="#0000FF">【编辑题目】</font></td>
  </tr>
  <%
  set rs=server.createobject("adodb.recordset")
  sql="select * from question where qid='"&trim(request.querystring("qid"))&"'"
  rs.open sql,conn,1,1
  if not rs.eof then

  %>
  <tr> 
    <td><table width="100%" border="0" align="center" bgcolor="#ffffff">
        <form name="form1" method="post" onsubmit="return check();" action="que_saveedit.asp?id=<%=request.querystring("qid")%>">
          <tr> 
            <td height="30"><div align="right"><strong>当前题号:</strong></div></td>
            <td height="30"><%=trim(rs("qid"))%></td>
          </tr>
          <tr> 
            <td width="100" height="30"> <div align="right"><strong>题目:</strong></div></td>
            <td height="30"> <input name="qname" type="text" id="qname" value="<%=trim(rs("qname"))%>" size="50">
            </td>
          </tr>

          <tr> 
            <td width="100" height="30"> <div align="right"><strong>题型:</strong></div></td>
            <td height="30">
			<input name="qtype" type="radio" value="1" <%if trim(rs("qtype"))=1 then%>checked<%end if%>>
              单选题 
              <input type="radio" name="qtype" value="2" <%if trim(rs("qtype"))=2 then%>checked<%end if%>>
              多选题
			  <input type="radio" name="qtype" value="3" <%if trim(rs("qtype"))=2 then%>checked<%end if%>>
              判断题
			</td>
          </tr>
          <tr> 
            <td width="100" height="30" valign="top"> <div align="right"><strong>可选项:</strong></div></td>
            <%
			a=split(trim(rs("rightkey")),",")
			b=ubound(a)
			%>
            <td height="30"><p>A: 
                <input name="key1" type="text" id="key1" value="<%=trim(rs("key1"))%>">
                <%
				for i=0 to b
				if trim(a(i))="A" then
				j=9
				end if
				next
				%>
                <input name="rightkey" type="checkbox" value="A" <%if cint(j)=9 then%>checked<%end if%>>
                此题为标准答案 <br>
                B: 
                <%
				for i=0 to b
				if trim(a(i))="B" then
				j=8
				end if
				next
				%>
                <input name="key2" type="text" id="key2" value="<%=trim(rs("key2"))%>">
                <input name="rightkey" type="checkbox" value="B" <%if cint(j)=8 then%>checked<%end if%>>
                <br>
                C: 
                <%
				for i=0 to b
				if trim(a(i))="C" then
				j=2
				end if
				next
				%>
                <input name="key3" type="text" id="key3" value="<%=trim(rs("key3"))%>">
                <input name="rightkey" type="checkbox" value="C" <%if cint(j)=2 then%>checked<%end if%>>
                <br>
                D: 
                <%
				for i=0 to b
				if trim(a(i))="D" then
				j=3
				end if
				next
				%>
                <input name="key4" type="text" id="key4" value="<%=trim(rs("key4"))%>">
                <input name="rightkey" type="checkbox" value="D" <%if cint(j)=3 then%>checked<%end if%>>
                <br>
                E: 
                <%
				for i=0 to b
				if trim(a(i))="E" then
				j=4
				end if
				next
				%>
                <input name="key5" type="text" id="key43" value="<%=trim(rs("key5"))%>">
                <input name="rightkey" type="checkbox" id="rightkey" value="E" <%if cint(j)=4 then%>checked<%end if%>>
                <br>
                F: 
                <%
				for i=0 to b
				if trim(a(i))="F" then
				j=5
				end if
				next
				%>
                <input name="key6" type="text" id="key5" value="<%=trim(rs("key6"))%>">
                <input name="rightkey" type="checkbox" id="rightkey3" value="F" <%if cint(j)=5 then%>checked<%end if%>>
                <br>

              </p></td>
          </tr>
          <tr> 
            <td width="100" height="30">&nbsp;</td>
            <td height="30">
			  <input type="submit" name="ok" id="ok" value="提交"> 
              <input type="reset" name="Submit2" value="取消修改"> 
			  <input type="button" name="close" value="关闭" onClick="window.close()"> 
			  <input type="hidden" name="qid" value="<%=trim(rs("qid"))%>">
		    </td>
          </tr>
        </form>
        <%
		end if
		rs.close
		set rs=nothing
		%>
      </table></td>
  </tr>
</table>
</body>
</html>
<%
conn.close
set conn=nothing
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -