回 帖 发 新 帖 刷新版面

主题:[讨论]请大家帮分析以下代码各主要段的意思


[color=FF00FF]以下代码实现了添加,删除,更新的功能。请大家帮指出分别是哪部分代码实现添加的功能,哪部分实现删除功能,哪部分实现更新的功能,哪部分代码表明使用了文本编辑器,使用的是什么版本的文本编辑器。[/color]

<!--#include file="../inc/config2.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="css/admin.css" rel="stylesheet" type="text/css" />
<title>公告管理</title>
<style type="text/css">
<!--
body,td,th {
    font-size: 12px;
}
.STYLE1 {
    color: #135294;
    font-weight: bold;
    font-size: 14px;
}
.STYLE4 {color: #135294; font-weight: bold; }
-->
</style>
<script language="JavaScript" type="text/javascript" src="../js/jQuery.js"></script>
<script language="JavaScript" type="text/javascript" src="../js/jQuery.form.js"></script>
<script language="JavaScript" type="text/javascript" src="../js/Fun.js"></script>
<script language="javascript" type="text/javascript" src="../js/thickbox.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>公告管理</title>
</head>

<body>
<% dim a_user
  a_user=session("admin_user")
  if (a_user="") then 
  
  Response.Redirect("login.html")
  else
  end if
  %>

<% 
types=request.QueryString("types")
select case types
 case 1
 %>
<form name="classediter" id="classediter" method="post"  action="kecheng_editer.asp?types=6">
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#C4D8ED">
  <tr>
    <td height="30" colspan="2" align="center" bgcolor="#E4EDF9"><span class="STYLE1">网上课程管理</span></td>
  </tr>
    <tr>
   <td><font color="#666666">类别</font></td> 
    <td height="25"  align="left">
       <%dim classid
    classid=request.QueryString("classid")
    sqlstr="select * from [kecheng_class]  order by id asc"
    rs.open sqlstr,conn,1,3%>
       <% do  while not rs.eof %>
       <a href="?types=1&classid=<%=rs("id")%>">[<%=rs("kc_class")%>]</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <% rs.movenext
       loop
       rs.close
       %>     </td>
    </tr>
    <% if (classid<>"") then
    sqlstr="select * from [kecheng]  where class_id="&classid&" order by id desc"
    else
    sqlstr="select * from [kecheng] order by id desc"
    end if
    rs.open sqlstr,conn,1,3
    if not rs.eof then
    article_size=9
    rs.pagesize=article_size
    page_now=1
    if trim(request.QueryString("page"))<>"" then
    page_now=cint(trim(request.QueryString("page")))
    end if
    if page_now>rs.pagecount or page_now<0 then
    page_now=1
    end if 
    page_count=rs.pagecount
    rs.absolutepage=page_now
    i=1
    while (not rs.eof) and i<article_size+1
    %>
      <tr>
    <td width="14%" height="25" align="right" bgcolor="#FFFFFF" class="STYLE4">&nbsp;</td>
    <td width="86%" height="25"  align="left" bgcolor="#FFFFFF">&nbsp;&nbsp;<span class="STYLE4"></span>
      <input    type="text" name="class"  readOnly   size="70" value="<%=rs("title")%>" >      
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="kecheng_editer.asp?id=<%=rs("id")%>&types=5"> 编辑</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="kecheng_editer.asp?id=<%=rs("id")%>&types=4"> 删除</a>&nbsp;&nbsp;<font color="#CCCCCC"><%=rs("time")%></font></td>
  </tr>
    <%
    rs.movenext
      i=i+1
      wend
    %>
    <tr>
      <td height="25" colspan="2" align="center"><%=jk_pagecute(article_size,page_count,page_now,"?",9,"#ff0000")%></td>
    </tr>
    <%
    else
    %>
    <tr>
      <td height="25" colspan="2">&nbsp;&nbsp;暂无任何信息</td>
    </tr>
    <%
    end if
    rs.close
    %>
  <tr>
    <td height="25" align="right" bgcolor="#FFFFFF" class="STYLE4">&nbsp;</td>
    <td height="25" align="left" bgcolor="#FFFFFF">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      <input type="submit" value="添加" /></td>
  </tr>
  <tr>
    <td height="25" colspan="2" bgcolor="#FFFFFF" align="center">&nbsp;</td>
  </tr>
  
   <tr>  </tr>
</table>
</form>
<% 
case 2
classid=request.Form("class")
title=trim(request.Form("title"))
content=trim(request.Form("content"))
set rsb=server.createobject("adodb.recordset")
sqlstr="select * from [kecheng]"
rsb.open sqlstr,conn,1,3
rsb.addnew
rsb("title")=title
rsb("content")=content
rsb("class_id")=classid
rsb("hit")=rsb("hit")+1
rsb("time")=now
rsb.update
rsb.close
set rsb=nothing
response.Redirect("kecheng_editer.asp?types=1")
%>
<%
case 3
id=request.QueryString("id")
title=trim(request.Form("title"))
content=trim(request.Form("content"))
set rsb=server.createobject("adodb.recordset")
sqlstr="select * from [kecheng]  where id="&id
rsb.open sqlstr,conn,1,3
rsb("title")=title
rsb("content")=content
rsb.update
response.Redirect("kecheng_editer.asp?types=1")
rsb.close
set rsb=nothing

%>
<%
case 4
id=request.QueryString("id")
set rsb=server.createobject("adodb.recordset")
sqlstr="delete * from [kecheng]  where id="&id
rsb.open sqlstr,conn,1,3
response.Redirect("kecheng_editer.asp?types=1")
rsb.close

%>
<% 
case 5
id=request.QueryString("id")
set rsb=server.createobject("adodb.recordset")
sqlstr="select * from [kecheng]  where id="&id
rsb.open sqlstr,conn,1,3
%>
<form name="editer"  method="post"  action="kecheng_editer.asp?types=3&id=<%=rsb("id")%>">
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#C4D8ED">
    <tr>
    <td width="19%" height="25" align="right" bgcolor="#FFFFFF" class="STYLE4"><font color="red">标题</font>:</td>
    <td width="81%" height="25" align="left" bgcolor="#FFFFFF">&nbsp;&nbsp;<input type="text" name="title"  size="70" value="<%=rsb("title")%>">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
    </tr>
  <tr>
    <td width="19%" height="25" align="right" bgcolor="#FFFFFF" class="STYLE4"><font color="red">内容</font>:</td>
    <td width="81%" height="25" align="left" bgcolor="#FFFFFF">&nbsp;
     
      <iframe id="eWebEditor1" src="iXs_Editor/ewebeditor.htm?id=content&style=blue&extcss=_example/myeditorarea.css" frameborder="0" scrolling="no" width="650" height="290">
    </iframe>
        <input name="content" type="hidden" id="content" value="<%=rsb("content")%>">
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
   </tr>
  <tr>
    <td height="25" colspan="2" bgcolor="#FFFFFF" align="center"><input type="submit" value="确定修改" /></td>
  </tr>
</table>
</form>
<% rsb.close
   %>
   
   <% 
case 6
%>
<form name="editer"  method="post"   action="kecheng_editer.asp?types=2">
<table width="101%" border="0" cellpadding="0" cellspacing="1" bgcolor="#C4D8ED">
  <tr>
    <td height="30" colspan="2" align="center" bgcolor="#E4EDF9"><span class="STYLE1">添加课程</span></td>
  </tr>
    <tr>
    <td width="19%" height="25" align="right" bgcolor="#FFFFFF" class="STYLE4"><font color="red">选择类别</font>:</td>
    <td width="81%" height="25" align="left" bgcolor="#FFFFFF">&nbsp;&nbsp;
    <% set rsb=server.createobject("adodb.recordset")
sqlstr="select * from [kecheng_class] order by id asc"
rsb.open sqlstr,conn,1,3
%>
     <select name="class" size="" style="font-size: 9pt;">
                              <% do while not rsb.eof %>
                              <option value="<%=rsb("id")%>" selected="selected"%><%=rsb("kc_class")%></option>
                              <% rsb.movenext
                                 loop
                                 rsb.close %>
        </select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;                            </td>
    </tr>
    <tr>
    <td width="19%" height="25" align="right" bgcolor="#FFFFFF" class="STYLE4"><font color="red">标题</font>:</td>
    <td width="81%" height="25" align="left" bgcolor="#FFFFFF">&nbsp;&nbsp;<input type="text" name="title"  size="70" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
    </tr>

   <tr>
    <td width="19%" height="25" align="right" bgcolor="#FFFFFF" class="STYLE4"><font color="red">内容</font>:</td>
    <td width="81%" height="25" align="left" bgcolor="#FFFFFF">&nbsp;&nbsp;
     
      <iframe id="eWebEditor1" src="iXs_Editor/ewebeditor.htm?id=content&style=blue&extcss=_example/myeditorarea.css" frameborder="0" scrolling="no" width="650" height="290">
    </iframe>
        <input name="content" type="hidden" id="content" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
   </tr>
  <tr>
    <td width="19%" height="25" align="right" bgcolor="#FFFFFF" class="STYLE4">&nbsp;</td>
    <td width="81%" height="25" align="left" bgcolor="#FFFFFF">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      <input type="submit" value="确定" ></td>
  </tr>
</table>
</form>
<%   end select
   %>

</body>
</html>
</div>

回复列表 (共1个回复)

沙发

case 2 以下添加,case 3以下修改,case4 删除
<iframe id="eWebEditor1" src="iXs_Editor/ewebeditor.htm?id=content&style=blue&extcss=_example/myeditorarea.css" frameborder="0" scrolling="no" width="650" height="290">
    </iframe> 此段为文本编辑器, ewebeditor为编辑器的名称

我来回复

您尚未登录,请登录后再回复。点此登录或注册