找回密码
 注册
搜索
热搜: 回贴
  • 前程无忧官网首页 有什么好的平台可以
  • 最新的销售平台 互联网营销的平台有哪
  • 制作网页的基本流程 网页制作和网页设
  • 【帝国CMS】输出带序号的列表(数字排
  • 网站建设公司 三一,中联,极东泵车的
  • 织梦 建站 织梦网站模版后台怎么更改
  • 云服务官网 哪些网站有免费的简历模板
  • 如何建网站要什么条件 建网站要用什么
  • 吉林市移动公司电话 吉林省退休人员网
  • 设计类毕业论文 网站设计与实现毕业论
查看: 144|回复: 0

给大家看一段代码

[复制链接]
发表于 2009-9-15 02:17:43 | 显示全部楼层 |阅读模式 IP:江苏扬州
下面的代码是一个新闻发布网站的后台,主要是为了添加新闻分类用的,可是这个只能添加一个小类,请问各位大侠如果我想把二级分类的个数添加到四个或者五个应该改哪个参数呢?这个代码似乎不是很难,但是我刚刚学,时间很紧,没时间仔细研究~~跪请各位帮忙了~~~如果没耐心看大概说一下就可以了,谢谢~~

<%@language=VBScript codepage=936 %>
<%
if not session("check")="checked" then
response.Redirect "login.asp"
end if
%>
<!--#include file="conn.asp"-->
<%
dim Action,BigClassName,SmallClassName,rs,FoundErr,ErrMsg
Action=trim(Request("Action"))
BigClassName=trim(request("BigClassName"))
SmallClassName=trim(request("SmallClassName"))
if Action="Add" then
    if BigClassName="" then
        FoundErr=True
        ErrMsg=ErrMsg & "<br><li>文章大类名不能为空!</li>"
    end if
    if SmallClassName="" then
        FoundErr=True
        ErrMsg=ErrMsg & "<br><li>文章小类名不能为空!</li>"
    end if
    if FoundErr<>True then
        Set rs=Server.CreateObject("Adodb.RecordSet")
        rs.open "Select * From SmallClass Where BigClassName='" & BigClassName & "' AND SmallClassName='" & SmallClassName & "'",conn,1,3
        if not rs.EOF then
            FoundErr=True
            ErrMsg=ErrMsg & "<br><li>“" & BigClassName & "”中已经存在文章小类“" & SmallClassName & "”!</li>"
        else
             rs.addnew
            rs("BigClassName")=BigClassName
             rs("SmallClassName")=SmallClassName
             rs.update
             rs.Close
             set rs=Nothing
             call CloseConn()
            Response.Redirect "ClassManage.asp"  
        end if
    end if
end if
if FoundErr=True then
    call WriteErrMsg()
else
%>
<script language="JavaScript" type="text/JavaScript">
function checkSmall()
{
  if (document.form2.BigClassName.value=="")
  {
    alert("请先添加大类名称!");
    document.form1.BigClassName.focus();
    return false;
  }

  if (document.form2.SmallClassName.value=="")
  {
    alert("小类名称不能为空!");
    document.form2.SmallClassName.focus();
    return false;
  }
}
</script>
<head>
<link href="images/private.css" rel="stylesheet" type="text/css" />
<script language='javascript' src='images/private.js'></SCRIPT>
</head>
<form name="form2" method="post" action="ClassAddSmall.asp" onsubmit="return checkSmall()">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center" valign="top">
      <div align="center">
      <table width="350" border="0" cellspacing="1" class="list">
          <tr bgcolor="#999999" class="title">
            <th height="25" colspan="2" align="center">
      产品类别设置<br>
            </th>
          </tr>
          <tr bgcolor="#999999" class="title">
            <td height="25" colspan="2" align="center"><strong>添加小类</strong></td>
          </tr>
          <tr class="tdbg">
            <td width="47%" height="22" bgcolor="#C0C0C0">
            <p align="right"><strong>所属大类:</strong></td>
            <td width="52%" bgcolor="#E3E3E3"> <select name="BigClassName">
                <%
    dim rsBigClass
    set rsBigClass=server.CreateObject("adodb.recordset")
    rsBigClass.open "Select * From BigClass",conn,1,1
    if rsBigClass.bof and rsBigClass.bof then
        response.write "<option>请先添加文章大类</option>"
    else
        do while not rsBigClass.eof
            if rsBigClass("BigClassName")=BigClassName then
                response.write "<option value='"& rsBigClass("BigClassName") & "' selected>" & rsBigClass("BigClassName") & "</option>"
            else
                response.write "<option value='"& rsBigClass("BigClassName") & "'>" & rsBigClass("BigClassName") & "</option>"
            end if
            rsBigClass.movenext
        loop
    end if
    rsBigClass.close
    set rsBigClass=nothing
    %>
              </select></td>
          </tr>
          <tr class="tdbg">
            <td width="47%" height="22" bgcolor="#C0C0C0">
            <p align="right"><strong>小类名称:</strong></td>
            <td bgcolor="#E3E3E3"> <input name="SmallClassName" type="text" size="20" maxlength="30"></td>
          </tr>
          <tr class="tdbg">
            <td height="22" align="center" bgcolor="#C0C0C0" width="47%">  </td>
            <td height="22" align="center" bgcolor="#E3E3E3"> <div align="left">
                <input name="Action" type="hidden" id="Action3" value="Add">
                <input name="Add" type="submit" value=" 添 加 ">
              </div></td>
          </tr>
        </table>
      </div>
      </form></td>
  </tr>
</table>
<%
end if
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|小黑屋|最新主题|手机版|微赢网络技术论坛 ( 苏ICP备08020429号 )

GMT+8, 2024-9-29 21:31 , Processed in 0.210903 second(s), 11 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表