www.gusucode.com > 盐城分类信息网asp源码程序 > admin/fenlei.asp

    <!--#include file=conn.asp-->
<!--#include file=cookies.asp-->
<script>
function loadThreadFollow(t_id,b_id){
	var targetImg =eval("document.all.followImg" + t_id);
	var targetDiv =eval("document.all.follow" + t_id);
	
	if ("object"==typeof(targetImg)){
		if (targetDiv.style.display!='block'){
			targetDiv.style.display="block";
			
		}else{
			targetDiv.style.display="none";
		}
	}
}
</script>
<%
dim rs,sql,class1,i,k
if request("cnmai")="class1" then
call add()
response.end
end if
if request("cnmai")="del" then
call del()
response.end
end if
k=1
set rs = Server.CreateObject("ADODB.RecordSet")
sql="select * from [class1] order by paixu desc" 
rs.open sql,conn,1,1
%>
<link href="inc_style.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
body {
	background-color: #E7EEF5;
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
-->
</style><div align="center">
  <center>
  <form method="POST" action="fenlei.asp?cnmai=class1">
    <table width="50%" border="1" align="center" cellpadding="3" cellspacing="0" bordercolorlight="#335078" bordercolordark="#FFFFFF" bgcolor="#C5D5E4" style="font-size:12px; letter-spacing:1px;">

<tr bgcolor="#B6EBC4">
    <td height="25" width="322" bgcolor="#C5D5E4">
    <p align="center">分类总数:<font color="#666666"><b><%=rs.Recordcount%></b></font></td>
    </tr>
    <tr>
      <td width="322" height="21" align="center" bgcolor="#E8EEF4" >

        <div align="center">增加大类:
          <input type="text" name="class1" size="20" value="">
          
          
          </div></td>
    </tr>
    <tr>
      <td width="322" height="25" align="center" bgcolor="#E8EEF4" >
        <div align="center">排序数字:
          <input type="text" name="paixu" size="20" value="0">
        </div></td>
    </tr>
    <tr>
      <td width="322" height="25" bgcolor="#DFE8F0" style="border-top-style: none; border-top-width: medium">
<p> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
<input type="submit" value="&nbsp;提交&nbsp;" name="B1" style="color: #000000; border: 0px solid #000000; background-color: #C5D5E4"></td>
    </tr>
  </table>
  </form>
  </center>
</div>
             <p align="center">改变分类后请点击“<a href="fenlei_html.asp"><font color="#0000FF">生成分类页面</font></a>”</p>
             <div align="center">
               <center>
             <table width="80%" border="1" align="center" cellpadding="3" cellspacing="0" bordercolorlight="#335078" bordercolordark="#FFFFFF" bgcolor="#C5D5E4" style="font-size:12px; letter-spacing:1px;">

<tr bgcolor="#B6EBC4">
              <td width="93" height="20"  valign="bottom" bgcolor="#C5D5E4" > 
        <p align="center">编号</td>

              <td height="20"  valign="bottom" width="238" bgcolor="#C5D5E4" > 
                名称</td>

              <td " height="20"  valign="bottom" colspan="3" bgcolor="#C5D5E4"> 
        <p align="center">操作</td>

              <td height="20"  valign="bottom" width="86" bgcolor="#C5D5E4" >
        <p align="center">排序</td>
             </tr>
             <%do while not rs.eof%>
			  <tr>
              <td width="93" " height="20"  valign="bottom" bgcolor="#DBE4EE"> 
               <div align="center">
                 <font color="#000000"><b><%=k%></b></font></div>
              </td>

              <td width="238" height="20"  valign="bottom" bgcolor="#DBE4EE"> 
              <p align="left"> 
              <font color="#FF0000"> 
              <span id="followImg<%=k%>" style="CURSOR: hand" onclick="loadThreadFollow(<%=k%>,5)"><%=rs("class1")%></span></font></td>

              <td width="154"  height="20"  valign="bottom" bgcolor="#DBE4EE"> 
              <p align="center"> 
              <font color="#800000"><span style="text-decoration: none"><a href="fenlei.asp?id=<%=rs("id")%>&cnmai=del">
              <font color="#FF0000">[删除]</font></a></span></font></td>

              <td width="114"  height="20"  valign="bottom" bgcolor="#DBE4EE"> 
              <p align="center"><font color="#FF0000">[</font><a href="fenlei_2.asp?id=<%=rs("id")%>"><font color="#FF0000">添加分类</font></a><font color="#FF0000">]</font></td>

              <td width="47" height="20"  valign="bottom" bgcolor="#DBE4EE"> 
              <p align="center"> 
              <font color="#800000"><span style="text-decoration: none"><a href="#" ONCLICK="window.open('fenleiedit.asp?id=<%=rs("id")%>','Sample','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=325,height=100,left=100,top=100')">
              <font color="#FF0000">[修改]</font></a></span></font></td>

              <td height="20"  valign="bottom" bgcolor="#DBE4EE">
              <p align="center"><font color="#FF0000"><%=rs("paixu")%></font></td>
             </tr>
			  <tr style="display:none" id="follow<%=k%>">
              <td height="20" colspan="6"  valign="bottom" bgcolor="#E6ECF2"> 
               
                   <table width="80%" border="1" align="center" cellpadding="3" cellspacing="0" bordercolorlight="#335078" bordercolordark="#FFFFFF" bgcolor="#DBE4EE" style="font-size:12px; letter-spacing:1px;">


               <%
               dim rs1,sql1
               i=1
               set rs1 = Server.CreateObject("ADODB.RecordSet")
               sql1="select * from [class2] where class1="&cstr(rs("id"))&" order by paixu desc"
               rs1.open sql1,conn,1,1
               if rs1.eof then
               response.write "<tr><td><font color=""#ff0000""><p align=""center"">没有类别</font></td></tr>"
               else
               %>
               <tr bgcolor="#B6EBC4">
               <%do while not rs1.eof%>
               <td height=20 width="72">
               <p align="center"><font color="#666666"><%=i%></font></td><td height=20 width="200">
               <font color="#666666"><%=rs1("class2")%></font></td>
                 <td height=20 width="27"> 
              <font color="#800000"><span style="text-decoration: none"><a href="fenlei_2editdel.asp?id=<%=rs1("id")%>&cnmai=del">
              <font color="#666666">[删]</font></a></span></font></td>
                 <td height=20 width="29"> 
              <font color="#800000"><span style="text-decoration: none"><a href="#" ONCLICK="window.open('fenlei_2edit.asp?paixu=<%=rs1("paixu")%>&class1=<%=rs1("class1")%>&class2=<%=rs1("class2")%>&classid=<%=rs1("id")%>','Sample','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=325,height=100,left=100,top=100')">
              <font color="#666666">[修]</font></a></span></font></td>
                 <td height=20 width="31"> </td>
                 <td height=20 width="46">
                 <p align="center"><font color="#666666"><%=rs1("paixu")%></font></td></tr>
               <%
               i=i+1
			   rs1.movenext
			   loop
               end if
               rs1.close
               set rs1=nothing
               %>
               </table>
             
               </td>

             </tr>
            <%
             k=k+1
			 rs.movenext
			 loop
			 %>
         </table>
             
<p align="center"><font color="#666666">说明:排序数字越大越靠前显示</font></p>

<%
rs.close
set rs=nothing
%>
<%
sub add()
class1=trim(request("class1"))
if class1="" then
response.write "<li>错误,类别为空!"
response.write "<meta http-equiv=refresh content=""2;URL=fenlei.asp"">"
response.end
end if
set rs = Server.CreateObject("ADODB.RecordSet")
sql="select * from [class1] where class1='"&trim(request("class1"))&"'"  
rs.open sql,conn,1,3
if rs.eof then
rs.addnew
rs("class1")=trim(request("class1"))
rs("paixu")=trim(request("paixu"))
rs.update
response.write "<li>添加大类成功。"
response.write "<meta http-equiv=refresh content=""1;URL=fenlei.asp"">"
rs.close
set rs=nothing
else
response.write "<li>错误,名称已经存在!"
rs.close
set rs=nothing
response.write "<meta http-equiv=refresh content=""2;URL=fenlei.asp"">"
response.end
end if
end sub
sub del()
dim rs,sql1,sql2,id
id=trim(request("id"))
if not isnumeric(id) or id="" then
response.write "<li>参数错误!"
response.end
end if
set rs=server.createobject("adodb.recordset")
sql1="delete from [class1] where id="&cstr(id)
rs.open sql1,conn,1,3
sql2="delete from [class2] where class1="&id&""
rs.open sql2,conn,1,3
sql="delete from [xinxi] where class1="&id&""
rs.open sql,conn,1,3
response.write "<font size=2>删除大类成功!</font><br>"
response.write "<meta http-equiv=refresh content=""1;URL=fenlei.asp"">"
end sub
closedb
%>