主题:[讨论]请大家帮分析以下代码各主要段的意思
[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>
<% 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"> </td>
<td width="86%" height="25" align="left" bgcolor="#FFFFFF"> <span class="STYLE4"></span>
<input type="text" name="class" readOnly size="70" value="<%=rs("title")%>" >
<a href="kecheng_editer.asp?id=<%=rs("id")%>&types=5"> 编辑</a> <a href="kecheng_editer.asp?id=<%=rs("id")%>&types=4"> 删除</a> <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"> 暂无任何信息</td>
</tr>
<%
end if
rs.close
%>
<tr>
<td height="25" align="right" bgcolor="#FFFFFF" class="STYLE4"> </td>
<td height="25" align="left" bgcolor="#FFFFFF">
<input type="submit" value="添加" /></td>
</tr>
<tr>
<td height="25" colspan="2" bgcolor="#FFFFFF" align="center"> </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"> <input type="text" name="title" size="70" value="<%=rsb("title")%>"> </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">
<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")%>">
</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">
<% 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> </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"> <input type="text" name="title" size="70" > </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">
<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" > </td>
</tr>
<tr>
<td width="19%" height="25" align="right" bgcolor="#FFFFFF" class="STYLE4"> </td>
<td width="81%" height="25" align="left" bgcolor="#FFFFFF">
<input type="submit" value="确定" ></td>
</tr>
</table>
</form>
<% end select
%>
</body>
</html>
</div>