<!--#include file="chklogin.asp"-->
<!--#include file="../conn.asp"-->
<%
Response.Buffer = True 
Response.Expires = -1
Response.ExpiresAbsolute = Now() - 1 
Response.Expires = 0 
Response.CacheControl = "no-cache"

dim xlmc,xldm,action,id,rs,sql,i,dalei
xlmc=request("xlmc")
xldm=request("xldm")
action=request("action")
id=request("id")
dalei=request("dalei")

if action="tj" then
call tj()
elseif action="xg" then
call xg()
elseif action="sc" then
call sc()
end if

sub tj()
set rs=server.CreateObject("adodb.recordset")
sql="select * from kw_xl"
rs.open sql,conn,1,3
if xlmc<>"" and xldm<>"" then
rs.addnew
rs("xiaolei")=xlmc
rs("xldm")=xldm
rs("dalei")=dalei
rs.update
   rs.close
   set rs=nothing
response.write "<script language=javascript>alert('成功添加了"&xlmc&"');history.go(-1);</script>"
response.End
end if
end sub

sub xg()
set rs=server.CreateObject("adodb.recordset")
sql="select * from kw_xl where id="&id
rs.open sql,conn,1,3
if xlmc<>"" and xldm<>"" then
rs("xiaolei")=xlmc
rs("xldm")=xldm
rs.update
   rs.close
   set rs=nothing
response.write "<script language=javascript>alert('成功的修改了"&xlmc&"');history.go(-1);</script>"
response.End
end if
end sub

sub sc()
sql="delete from kw_xl where id="&id
conn.execute sql
response.write "<script language=javascript>alert('成功的删除了分类');history.go(-1);</script>"
response.End
end sub
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>快问 - 小类设置</title>
<script>
	function regInput(obj, reg, inputStr)
	{
		var docSel	= document.selection.createRange()
		if (docSel.parentElement().tagName != "INPUT")	return false
		oSel = docSel.duplicate()
		oSel.text = ""
		var srcRange	= obj.createTextRange()
		oSel.setEndPoint("StartToStart", srcRange)
		var str = oSel.text + inputStr + srcRange.text.substr(oSel.text.length)
		return reg.test(str)
	}
</script>
<link href="css.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#FF9999">
<br>
<%
set rs=server.CreateObject("adodb.recordset")
sql="select * from kw_xl where dalei='"&dalei&"'"
rs.open sql,conn,1,1
%>
<table width="94%" border="0" align="center" cellpadding="0" cellspacing="1" class="tablebg">
  <tr align="center" bgcolor="#ff6666">
    <td height="25" colspan="3" class="font_bt">小 类 名 称 设 置</td>
  </tr>
  <tr align="center" bgcolor="#ff6666">
    <td width="37%" height="30">小类名称</td>
    <td width="30%">设置数值</td>
    <td width="33%">管理按钮</td>
  </tr>
  <%for i=1 to rs.recordcount%>
  <form action="kw_xl.asp?action=xg&id=<%=rs("id")%>" method="post">
  <tr align="center" bgcolor="#ff6666">
    <td height="30"><input name="xlmc" type="text" size="18" value="<%=rs("xiaolei")%>"></td>
    <td><input name="xldm" type="text" value="<%=rs("xldm")%>" size="5" onKeyPress="return regInput(this,	/^[0-9]*$/,String.fromCharCode(event.keyCode))"onpaste= "return regInput(this,/^[0-9]*$/,window.clipboardData.getData('Text'))" ondrop="return regInput(this,/^[0-9]*$/,event.dataTransfer.getData('Text'))"></td>
    <td><input type="submit" name="Submit" value="修 改">&nbsp;&nbsp;&nbsp;&nbsp;
    <a href="kw_xl.asp?action=sc&id=<%=rs("id")%>" onClick="return confirm('您确定进行删除操作吗？')">删除 ？</a></td>
  </tr>
  </form>
  <%
  rs.movenext
  next
     rs.close
   set rs=nothing
   closedb
  %>
  <form action="kw_xl.asp?action=tj&dalei=<%=dalei%>" method="post" name="kstj">
  <tr align="center" bgcolor="#ff6666">
    <td height="30"><input name="xlmc" type="text" size="18"></td>
    <td><input name="xldm" type="text" size="5" onKeyPress="return regInput(this,	/^[0-9]*$/,String.fromCharCode(event.keyCode))"onpaste= "return regInput(this,/^[0-9]*$/,window.clipboardData.getData('Text'))" ondrop="return regInput(this,/^[0-9]*$/,event.dataTransfer.getData('Text'))"></td>
    <td><input type="submit" name="Submit" value=" 添 加 "></td>
  </tr>
  </form>
</table>
</body>
</html>
