📄 manage_type.jsp
字号:
<% String getLoginmessage = (String) session.getValue("loginSign");
if(getLoginmessage!="admin"){
%>
<script language=javascript>
window.location="../../false.jsp"
</script>
<% }
%>
<html>
<head>
<%@ page contentType="text/html;charset=gb2312" %>
<title>管理商品类别 </title>
<link rel=stylesheet href="../../style.css" type="text/css">
<script LANGUAGE="javascript">
function update1()
{
var i=0
var selected
var nn = self.document.all.item("checkbox1")
if (nn!=null) {
if (typeof(nn.name)=="string"){
if (nn.checked){
selected=nn.name
i=i+1}}
else{
for (j=0;j<nn.length;j++){
if (self.document.all.item("checkbox1",j).checked){
i=i+1
selected=self.document.all.item("checkbox1",j).name
}
}
}
if (i!=1)
alert ("一次只能修改一条记录!")
else
window.open("edit_type.jsp?id="+selected,null,
"left=40,top=100,height=200,width=350,status=yes,toolbar=no,menubar=no,location=no")
}
}
function delete1()
{
if (confirm("真的要删除这些信息吗?")){
var i=0
var selected=""
var nn = self.document.all.item("checkbox1")
//document.write (typeof(nn.name))
if (nn!=null) {
if (typeof(nn.name)=="string"){
if (nn.checked){
selected=nn.name
i=i+1}}
else{
for (j=0; j<nn.length; j++)
{
if (self.document.all.item("checkbox1",j).checked){
i=i+1
if (selected=="")
selected=self.document.all.item("checkbox1",j).name
else
selected=selected+","+self.document.all.item("checkbox1",j).name
}
}
}
if (i==1)
window.open("del_type.jsp?id="+selected,null,
"left=40,top=100,height=200,width=350,status=yes,toolbar=no,menubar=no,location=no")
else
alert ("每次只能删除一条记录!")
}
}
}
</script>
</head>
<body>
<script LANGUAGE="javascript">
function submit11()
{
self.location.replace("manage_type.jsp")
}
</script>
<center><p><h4><font color="blue">管理商品类别</font></h4></p>
<%@ page language="java" import="java.sql.*" %>
<jsp:useBean id="bidBean" scope="page" class="firm.firm" />
<%
//指定行数
int pageLine=5;
int totalRec=0;
int totalSub=0;
int intPage=1;
int i;
if (request.getParameter("page")!=null)
intPage=Integer.parseInt(request.getParameter("page"));
try{
ResultSet countrs=null;
//取得总记录数
countrs=bidBean.executeQuery("select count(*) as cnt from item");
if (countrs.next())
totalRec=countrs.getInt("cnt");
countrs.close();
bidBean.closeStmt();
}
catch(Exception e){
e.printStackTrace();
}
//取得总页数
int intPageCount=0;
intPageCount = (totalRec+pageLine-1) / pageLine;
%>
<%
ResultSet RS = bidBean.executeQuery("SELECT * FROM item order by type_id desc");
String mid;
String type1;
%>
<form action method="post" id="form1" name="form1">
<table border="1" cellspacing="0" width="440" bgcolor="#F0F8FF" bordercolorlight="#4DA6FF" bordercolordark="#ECF5FF">
<tr bgcolor='#c8cc98' align='center'>
<td width='20%'>类别ID</td>
<td width='60%'>商品类别</td>
<td width='20%' >选择</td>
</tr>
<%
if (intPageCount>0)
{
for(i=1;i<=(intPage-1)*pageLine;i++)
RS.next();
for(i=1;i<=pageLine;i++) {
if (RS.next()) {
type1=RS.getString("type");
mid=RS.getString("type_id");
%>
<tr>
<td width='20%' align='center'><%=mid%></td>
<td width='60%' align='center'><%=type1%></td>
<td width='20%' align='center'><INPUT type='checkbox' id=checkbox1 name="<%=mid%>" value="<%=mid%>"></td>
</tr>
<%
}
}
RS.close();
}
%>
<!--以下用于分页显示 -->
<%
out.print("<tr>");
if (intPageCount*pageLine<totalRec)
intPageCount++;
if (intPage>intPageCount )
intPage=intPageCount;
if (intPage < 1 )
intPage=1;
out.print("<form method='POST' name=fPageNum action='manage_type.jsp'>");
if (intPage<2)
out.print("<font color='999966'>首页 上一页</font> ");
else{
out.print("<a href='manage_type.jsp?page=1'>首页</a> ");
out.print("<a href='manage_type.jsp?page=" + (intPage-1) + "'>上一页</a> " );
}
if( intPage-intPageCount>=0 )
out.print("<font color='999966'>下一页 尾页</font>" );
else{
out.print("<a href='manage_type.jsp?page=" + (intPage+1)+ "'>下一页</a> <a href='manage_type.jsp?page=" + intPageCount + "'>尾页</a>");
}
out.print(" 页次:<strong><font color=red>"+intPage+"</font>/"+intPageCount+"</strong>页 " );
out.print(" 共<b>"+totalRec+"</b>条记录 <b>"+pageLine+"</b>条/页 " );
out.print(" 转到第<input type='text' name='page' size=2 maxlength=10 class=smallInput value="+intPage+">");
out.print("页<input class=buttonface type='submit' value='GO' name='cndok'></span></p></form>" );
out.print("</td>");
out.print("</tr>");
%>
</table>
<p align="center">
<input type="button" value="添加" id="button1" name="button1" size="10" class="buttonface" onclick="window.open('add_type.jsp',null,
'left=40,top=100,height=200,width=350,status=yes,toolbar=no,menubar=no,location=no')">
<input type="button" value="修改" id="button2" name="button2" size="4" class="buttonface" onclick="update1()">
<input type="button" value="删除" id="button3" name="button3" size="4" class="buttonface" onclick="delete1()">
</form>
</p>
<a href="javascript:window.close();">[关闭]</a>
</center></p>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -