<%@language=VBScript.Encode codepage=936 %>
<!--#include file="conn.asp"-->
<!--#include file="application.asp"-->
<!--#include file="admin.asp"-->
<!--#include file="Inc/Function.asp"-->
<%
IF Trim(Request("action"))="Add" then
   Fid  =Trim(Request("Fid"))
   ClassName=Trim(Request("ClassName"))
   set rs=server.CreateObject("adodb.recordset")
   rs.open"select * from [ProdClass] where ClassID is null",conn,1,3
   Rs.addnew
      Rs("Fid")=Fid
	  Rs("ClassName")=ClassName
   Rs.update
   Rs.close:set Rs=nothing
   Response.Redirect("Class.asp")
End If
%>
<script language = "JavaScript">
function CheckForm()
{
	if (document.myform.ClassName.value == "") {
		alert("类名没有填写.");
		document.myform.ClassName.focus();
		return false;
	}
	return true;    
}
</script>
<!-- #include file="Inc/Head.asp" -->

<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  <tr> 
   
    <td align="center" valign="top">
	<table width="95%" border="0" cellpadding="2" cellspacing="1" class="table_southidc">
        <form method="post" name="myform" onSubmit="return CheckForm();" action="ClassAdd.asp?action=Add">
          <tr> 
            <td class="back_southidc" height="30" colspan="2" align="center">添加分类信息</td>
          </tr>
          <tr bgcolor="#ECF5FF"> 
            <td width="111" height="25" align="right"><font color="#FF0000">*</font>所属分类：</td>
            <td width="834">
			<select name="Fid">
			<option value="0" <%if Request("FID")="" or Request("FID")="0" then response.Write("selected") end if%>>作为一级分类</option>
			<%
			set rs=server.CreateObject("adodb.recordset")
			rs.open"select * from [ProdClass] where Fid=0 Order by ClassID desc",conn,1,1
			do while not rs.eof
			 %>
			<option value="<%=rs("ClassID")%>" <%if trim(Request("FID"))=Cstr(trim(rs("ClassID"))) then response.Write("selected") end if%>><%=rs("ClassName")%></option>
			 <%
			rs.movenext
			loop
			rs.close:set rs=nothing
			%>
			</select>
			</td>
          </tr>
          <tr> 
            <td height="30" align="right" bgcolor="#ECF5FF">分类名称：</td>
            <td height="30" align="left" bgcolor="#ECF5FF"><input name="ClassName" type="text" class="input" size="30" maxlength="50"></td>
          </tr>
          <tr> 
            <td height="30" colspan="2" align="center" bgcolor="#ECF5FF"> <input type="submit" name="Submit" value="提交" class="input">
              　 
              <input type="reset" name="Submit" value="重置" class="input"> </td>
          </tr>
        </form>
      </table></td>
  </tr>
</table>
<!-- #include file="Inc/Foot.asp" -->