Nclass.asp
资源名称:NetPhone.rar [点击查看]
上传用户:xxtaishan
上传日期:2022-01-02
资源大小:4063k
文件大小:6k
源码类别:
IP电话/视频会议
开发平台:
ASP/ASPX
- <!--#include file="../../inc/conn.asp"-->
- <!--#include file="../../inc/func.asp"-->
- <%
- dim rs
- if request.form("submit")="添加" then
- if request.form("classid")="" then
- call showerr("系统提示:请先选择一级类别名称!")
- end if
- if request.form("nclassname")="" then
- call showerr("系统提示:请填写二级类别名称!")
- end if
- set rs=server.createobject("adodb.recordset")
- rs.open "nclass",conn,1,3
- rs.addnew
- rs("nclassname")=request.form("nclassname")
- rs("classid")=request.form("classid")
- rs.update
- call showmsg("系统提示:类别增加成功","?")
- end if
- if request.form("submit")="修改" then
- if request.form("nclassid")="" then
- call showerr("系统提示:请选择二级类别!")
- else
- if request.form("nclassn2")="" then
- call showerr("系统提示:二级类别名称不能为空!")
- end if
- set rs=server.createobject("adodb.recordset")
- rs.open "nclass where id="&request.form("nclassid"),conn,1,3
- rs("nclassname")=request.form("nclassn2")
- rs.update
- call showmsg("系统提示:类别修改成功","?")
- end if
- end if
- if request("submit")="删除" then
- if request("nclassid")="" then
- call showerr("系统提示:请选择类别!")
- end if
- conn.execute("delete from nclass where id="&request("nclassid"))
- call showmsg("系统提示:类别删除成功","?")
- end if
- sql="select * from nclass order by id asc"
- set rs=conn.execute(sql)
- %>
- <html>
- <head>
- <title></title>
- <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
- <script>
- var onecount;
- onecount=0;
- subcat = new Array();
- <%
- dim count
- count=0
- do while not rs.eof
- %>
- subcat[<%=count%>] = new Array("<%= trim(rs("nclassname"))%>","<%= trim(rs("classid"))%>","<%= trim(rs("id"))%>");
- <%
- count = count + 1
- rs.movenext
- loop
- rs.close
- %>
- onecount=<%=count%>;
- function changelocation(locationid)
- {
- document.form1.nclassid.length = 0;
- var locationid=locationid;
- var i;
- for (i=0;i < onecount; i++)
- {
- if (subcat[i][1] == locationid)
- {
- document.form1.nclassid.options[document.form1.nclassid.length] = new Option(subcat[i][0], subcat[i][2]);
- }
- }
- }
- function report()
- {
- var options_string = "";
- var the_select = window.document.form1.nclassid;
- for (loop=0; loop < the_select.options.length; loop++)
- {
- if (the_select.options[loop].selected == true)
- {
- options_string += the_select.options[loop].text;
- }
- }
- window.document.form1.nclassn2.value=options_string;
- }
- </script>
- <link href="../Images/style.css" rel="stylesheet" type="text/css">
- <style type="text/css">
- <!--
- .style1 {color: #FFFFFF}
- -->
- </style>
- </head>
- <body>
- <form name="form1" method="post" action="">
- <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#FFFFFF">
- <tr>
- <td width="100%">
- <div align="center"></div></td>
- </tr>
- <tr>
- <td width="100%">
- <table width="100%" border="1" cellspacing="0" cellpadding="2" bordercolordark="#ffffff" bordercolorlight="#000000">
- <tr>
- <td height="25" bgcolor="#23458B"><span class="style1">添加二级类别:</span></td>
- </tr>
- <tr>
- <td height="25"><%
- sql="select * from class order by id asc"
- set rs=conn.execute(sql)
- if not rs.eof then
- %>
- 选择类别:
- <select name="classid" id="select">
- <option value="">--请选择类别--</option>
- <%do while not rs.eof%>
- <option value="<%=rs("id")%>"><%=rs("classname")%></option>
- <%rs.movenext
- loop
- %>
- </select>
- 填写二级类别名称:
- <input name="nclassname" type="text" id="nclassname2" size="15">
- <input type="submit" name="Submit" value="添加">
- <%else%>
- 没有任何类别,请添加类别!
- <%end if%></td>
- </tr>
- </table>
- <br>
- <table width="100%" border="1" cellspacing="0" cellpadding="2" bordercolordark="#ffffff" bordercolorlight="#000000">
- <tr>
- <td height="25" bgcolor="#23458B"><span class="style1">对类别进行添加和删除:</span></td>
- </tr>
- <tr>
- <td height="50">
- <%
- dim selclass
- sql="select * from class"
- set rs=conn.execute(sql)
- if not rs.eof then
- %>
- 选择类别:
- <select name="classid2" id="classid2" onChange="changelocation(document.form1.classid2.options[document.form1.classid2.selectedIndex].value)">
- <option value="">--请选择类别--</option>
- <%
- if not rs.eof then
- selclass=rs("id")
- %>
- <option value="<%=rs("id")%>" selected><%=rs("classname")%></option>
- <%
- rs.movenext
- end if%>
- <%do while not rs.eof%>
- <option value="<%=rs("id")%>"><%=rs("classname")%></option>
- <%
- rs.movenext
- loop
- %>
- </select>
- <select name="nclassid" onChange="report();">
- <%
- sql="select * from nclass where classid="&selclass&" order by id asc"
- set rs=conn.execute(sql)
- if not(rs.eof and rs.bof) then
- do while not rs.eof%>
- <option value="<%=rs("id")%>"><%=rs("nclassname")%></option>
- <% rs.movenext
- loop
- end if
- %>
- </select>
- <br>
- 类别名称:
- <input name="nclassn2" type="text" id="nclassn2">
- <input type="submit" name="Submit" value="修改">
- <input type="button" name="Submit" value="删除" onClick="nclass_del();">
- <%else%>
- 没有任何类别,请添加类别!
- <%end if%>
- </td>
- </tr>
- </table></td>
- </tr>
- </table>
- </form>
- <script language="JavaScript">
- function nclass_del()
- {
- if(confirm('* 确定删除类别吗?'))
- {
- form1.action="?submit=删除&nclassid="+document.form1.nclassid.value;
- form1.submit();
- }
- }
- </script>
- </body>
- </html>