?? productcatemanage.asp
字號(hào):
<!--#include file="CheckAdminLogined.asp"-->
<!--#include file="../include/connstr.asp"-->
<!--#include file="../include/DefFunction.asp"-->
<% if request("cur_action")="addsave" then
if not isdate(request("T_AddTime")) then
response.write "<script>alert('添加時(shí)間的格式錯(cuò)誤,請(qǐng)重新輸入!');history.back();</script>"
response.End()
end if
sql_addsave="insert into tProductCate(Title,Content,AddTime) values('"&MyRequest(request("T_Title"))&"','"&MyRequest(request("T_Content"))&"','"&request("T_AddTime")&"')"
conn.execute sql_addsave
response.write "<script>alert('已經(jīng)成功添加');location.replace('ProductCateManage.asp');</script>"
response.end
end if
if request("cur_action")="editsave" then
if not isdate(request("T_AddTime")) then
response.write "<script>alert('添加時(shí)間的格式錯(cuò)誤,請(qǐng)重新輸入!');history.back();</script>"
response.End()
end if
sql_editsave="update tProductCate set Title='"&MyRequest(request("T_Title"))&"',Content='"&MyRequest(request("T_Content"))&"',AddTime='"&request("T_AddTime")&"' where ID="&request("EditID")
conn.execute sql_editsave
response.write "<script>alert('已經(jīng)成功修改');location.replace('ProductCateManage.asp?PageNo="&request("PageNo")&"');</script>"
response.end
end if
if request("cur_action")="delete" then
set rs_check=conn.execute("select * from tProduct where CateID="&request("EditID"))
if request("Affirm")="" or isnull(request("Affirm")) then Affirm="0" else Affrim=request("Affirm")
if not(rs_check.eof and rs_check.bof) and Affirm="0" then '判斷在產(chǎn)品庫(kù)中是否有此種類產(chǎn)品,如果有,要用戶再確認(rèn)
response.write "<script>if(confirm(""該種類還有產(chǎn)品,確定刪除嗎?\n刪除之后,該種類下的產(chǎn)品也會(huì)隨時(shí)刪除!"")){location.replace('?EditID="&request("EditID")&"&cur_action=delete&Affirm=1&PageNo="&request("PageNo")&"')}else{history.back();}</script>"
response.end
end if
if Affrim="1" then conn.execute("delete from tProduct where CateID="&request("EditID")) '刪除該種類下的產(chǎn)品
conn.execute("delete from tProductCate where ID="&request("EditID"))
response.write "<script>alert('已經(jīng)成功刪除');location.replace('ProductCateManage.asp?PageNo="&request("PageNo")&"');</script>"
response.end
end if
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="Images/AdminCss.css" rel="stylesheet" type="text/css">
<script src="../include/Jchar.js"></script>
<script language="JavaScript">
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
function check_data(){
if(Jtrim(document.form1.T_Title.value)==""){
alert("種類名稱不能為空,請(qǐng)重新填寫!")
document.form1.T_Title.focus();
return(false)
}
if(Jtrim(document.form1.T_AddTime.value)==""){
alert("添加時(shí)間不能為空,請(qǐng)重新填寫!")
document.form1.T_AddTime.focus();
return(false)
}
}
</script>
</head>
<body leftmargin="0" topmargin="0">
<table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="8" colspan="2"></td>
</tr>
<tr>
<td width="76" height="20" rowspan="2"><img src="Images/TopBt.gif" width="67" height="36"></td>
<td width="856" height="10"></td>
</tr>
<tr>
<td>我的位置:后臺(tái)管理系統(tǒng)._基本信息._產(chǎn)品種類管理</td>
</tr>
<tr>
<td height="4" colspan="2"></td>
</tr>
<tr>
<td colspan="2"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="E7E7E7">
<tr>
<td height="20"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="159" height="20" align="center" background="images/title1.gif" class="fontwintitle"><strong>產(chǎn)品種類管理</strong>
</td>
<td align="right" background="images/title2.gif"><img src="Images/Topicon.gif" width="11" height="11" align="absmiddle"> <a href="?cur_action=add"><strong><font color="#FF0000">添加種類</font></strong></a> </td>
<td width="10"><img src="images/title3.gif" width="10" height="20"></td>
</tr>
</table></td>
</tr>
<tr valign="top">
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="6" background="images/midder1.gif"><img src="images/midder1.gif" width="6" height="3"></td>
<td height="100%" align="center" valign="top">
<% if request("cur_action")="add" then%>
<br>
<table width="98%" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">
<form name="form1" method="post" action="?cur_action=addsave" onsumbit="return check_data()">
<tr>
<td height="22" colspan="2" align="center" bgcolor="#FFFFFF" class="fonttitle"><strong><font color="#FF0000">添加種類</font></strong></td>
</tr>
<tr>
<td width="15%" height="26" align="right" bgcolor="ECF2D6">
<font color="#FF0000">*</font> 種類名稱:</td>
<td width="85%" bgcolor="#FFFFFF"> <input name="T_Title" type="text" id="T_Title" size="30"></td>
</tr>
<tr>
<td height="100" align="right" bgcolor="ECF2D6"> 備注:</td>
<td bgcolor="#FFFFFF"> <textarea name="T_Content" cols="50" rows="6" id="T_Content"></textarea></td>
</tr>
<tr>
<td height="26" align="right" bgcolor="ECF2D6"> <font color="#CC0000">*</font>
添加時(shí)間:</td>
<td bgcolor="#FFFFFF"> <input name="T_AddTime" type="text" id="T_AddTime" size="30" value="<%=now()%>">
</td>
</tr>
<tr>
<td height="31" colspan="2" align="center" bgcolor="#FFFFFF"><input type="submit" name="Submit" value="正確提交" onClick="return check_data(this.form)">
<input type="reset" name="Submit2" value="重新填寫"> <input type="button" name="Submit3" value="返回" onClick="javascript:history.back();"></td>
</tr>
</form>
</table>
<%end if
if request("cur_action")="edit" then
set rs_edit=server.CreateObject("adodb.recordset")
sql_edit="select * from tProductCate where ID="&request("EditID")
rs_edit.open sql_edit,conn,1,1
if rs_edit.bof and rs_edit.eof then
response.write "<script>alert('讀取數(shù)據(jù)時(shí)出錯(cuò),請(qǐng)與管理員聯(lián)系!');history.back();</script>"
response.end
end if
%>
<br>
<table width="98%" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">
<form name="form1" method="post" action="?cur_action=editsave&PageNo=<%=request("PageNo")%>&EditID=<%=request("EditID")%>" onSubmit="return check_data()">
<tr>
<td height="22" colspan="2" align="center" bgcolor="#FFFFFF" class="fonttitle"><strong><font color="#CC0000">修改種類</font></strong></td>
</tr>
<tr>
<td width="15%" height="26" align="right" bgcolor="ECF2D6">
<font color="#CC0000">*</font> 種類名稱:</td>
<td width="85%" bgcolor="#FFFFFF"> <input name="T_Title" type="text" id="T_Title" size="30" value="<%=rs_edit("Title")%>">
</td>
</tr>
<tr>
<td height="98" align="right" bgcolor="ECF2D6">備注:</td>
<td bgcolor="#FFFFFF"> <textarea name="T_Content" cols="50" rows="6" id="T_Content"><%=rs_edit("Content")%></textarea></td>
</tr>
<tr>
<td height="22" align="right" bgcolor="ECF2D6"><font color="#CC0000">*</font>
添加時(shí)間:</td>
<td bgcolor="#FFFFFF"> <input name="T_AddTime" type="text" id="T_AddTime" size="30" value="<%=rs_edit("AddTime")%>">
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="31" colspan="2" align="center">
<input type="submit" name="Submit4" value="正確提交" onClick="return check_data(this.form)">
<input type="reset" name="Submit22" value="重新填寫"> <input type="button" name="Submit32" value="返回" onClick="javascript:history.back();"></td>
</tr>
</form>
</table>
<%end if
'----------------------------
PERPAGE =15
PageNo=request("PageNo")
set rs=server.createobject("ADODB.recordset")
sql="select * from tProductCate order by AddTime desc"
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write "<br>暫時(shí)沒(méi)有數(shù)據(jù)!"
else
rs.pagesize = PERPAGE
if isempty(PageNo) or cstr(PageNo)<"1" then PageNo = 1
CurPage=PageNo
if int(PageNo)>=int(rs.pagecount) then CurPage=cint(rs.pagecount)
rs.absolutepage = CurPage
%>
<br><table width="98%" border="0" cellspacing="0" cellpadding="0">
<tr align="center">
<td colspan="2"><table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">
<tr align="center" bgcolor="#FFFFFF">
<td width="7%" height="22"><strong>ID</strong></td>
<td width="27%" height="22"><strong>種類名稱</strong></td>
<td width="36%"><strong>備注</strong></td>
<td width="16%"><strong>添加時(shí)間</strong></td>
<td width="14%" height="22"><strong>功能操作</strong></td>
</tr>
<% for i = 1 to rs.pagesize %>
<tr align="center" onMouseOver="this.style.backgroundColor='#e7e7e7';" onMouseOut="this.style.backgroundColor='#ffffff'" bgcolor="#FFFFFF">
<td height="22"><%=rs("ID")%></td>
<td height="22"><%=rs("Title")%> </td>
<td height="22"><%=rs("Content")%></td>
<td height="22"><%=rs("AddTime")%></td>
<td height="22"> <a href='?cur_action=edit&EditID=<%=rs("ID")%>&PageNo=<%=PageNo%>'>修改</a>|<a href="?cur_action=delete&EditID=<%=rs("ID")%>&PageNo=<%=PageNo%>" onclick="{if(confirm('確定刪除選定的紀(jì)錄嗎?')){return true;}return false;}">刪除</a></td>
</tr>
<% rs.movenext
if rs.eof then
i = i + 1
exit for
end if
next %>
</table></td>
</tr>
<tr>
<td height="8" colspan="2"></td>
</tr>
<tr>
<td width="33%"> 頁(yè)次:<b><%=CurPage%></b>/<b><%=rs.pagecount %></b>頁(yè) 共<b><%=rs.recordcount %></b>條記錄</td>
<td width="67%" align="right">
<%
if CurPage = 1 then
response.write " 首頁(yè) | 上一頁(yè) | "
else
response.write "<a href='?PageNo=1&T_key="&request("T_key")&"'><b> 首頁(yè) </b></a> | <a href='?PageNo="&CurPage-1&"&T_key="&request("T_key")&"'><b>上一頁(yè)</b></a>| "
end if
if CurPage = rs.pagecount then
response.write "后一頁(yè) | 尾頁(yè) "
else
response.write "<a href='?PageNo="&CurPage+1&"&T_key="&request("T_key")&"'><b>后一頁(yè)</b> </a>| <a href='?PageNo="&rs.pagecount&"&T_key="&request("T_key")&"'><b>尾頁(yè)</b> </a>"
end if
%>
跳轉(zhuǎn)到:<select name="menu1" onChange="MM_jumpMenu('parent.frames[\'right\']',this,0)">
<% for i=1 to rs.pagecount
if CurPage=i then
response.write "<option value='?PageNo="&i&"&T_key="&request("T_key")&"' selected>第"&i&"頁(yè)"
else
response.write "<option value='?PageNo="&i&"&T_key="&request("T_key")&"'>第"&i&"頁(yè)"
end if
next
%>
</select>
</td>
</tr>
</table>
<%end if%>
<br> <br> <br> <br> </td>
<td width="2" background="images/midder2.gif"><img src="images/midder2.gif" width="2" height="3"></td>
</tr>
<tr>
<td valign="top"><img src="images/bottom1.gif" width="6" height="14"></td>
<td height="14" valign="top" background="images/bottom2.gif"><img src="images/bottom2.gif" width="2" height="14"></td>
<td valign="top"><img src="images/bottom3.gif" width="2" height="14"></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -