?? default.asp
字號:
<%
if session("admin_name")="" then
response.redirect "../index.asp"
response.end
end if
%>
<!--#include file="../inc/adconn.asp"-->
<link rel="stylesheet" type="text/css" href="../style.css">
<BODY bgcolor="#FFFFFF" marginheight=0 marginwidth=0 leftmargin=5>
<%
dim totalPut
dim CurrentPage
dim TotalPages
dim i,j
const MaxPerPage=8
if not isempty(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if
dim rs
dim sql
if not isempty(request("id")) then
idlist=request("id")
if instr(idlist,",")>0 then
dim idarr
idArr=split(idlist)
for i = 0 to ubound(idarr)
id=clng(idarr(i))
call deleteannounce(id)
next
else
call deleteannounce(clng(idlist))
end if
end if
typeid=request("typeid")
set rs=server.createobject("adodb.recordset")
if typeid="" then
sql="select * from news where Title like '%"&request("txtitle")&"%' order by NewsID desc"
elseif request("txtitle")<>"" then
sql="select * from news where Title like '%"&request("txtitle")&"%' and typeid="+cstr(typeid)+" order by NewsID desc"
else
sql="select * from news where typeid="+cstr(typeid)+" order by NewsID desc"
end if
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write "<p align='center'>對不起,暫時還沒有相關信息!!!</p>"%>
<CENTER>
<TABLE border="0" cellspacing="0" width="100%" cellpadding="0">
<TR>
<TD height=25 align=left bgcolor="#FFCC00"><a href="add.asp?typeid=<%=typeid%>"> 添加<img border=0 alt="錄入新聞數據" src="../images/add.gif" align="absbottom"></a></TD>
</TR>
</TABLE>
<%else
totalPut=rs.recordcount
if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if
end if
if currentPage=1 then
showContent totalput,MaxPerPage
showpage totalput,MaxPerPage,"default.asp"
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showContent totalput,MaxPerPage
showpage totalput,MaxPerPage,"default.asp"
else
currentPage=1
showContent totalput,MaxPerPage
showpage totalput,MaxPerPage,"default.asp"
end if
end if
rs.close
end if
set rs=nothing
sub showContent (totalput,MaxPerPage)
%>
<CENTER>
<TABLE border=0 cellPadding=3 cellSpacing=1 width="100%">
<TBODY>
<Form name="search" method="POST" action="default.asp">
<TR>
<TD height=30>
<font color="#ff0000">點擊新聞標題進行相應操作</font>
</td>
<TD>
<td><IMG border=0 src="../images/search.gif"></td>
<TD> 搜索關鍵字:<input type="text" name="txtitle" size="25">
<select name="typeid">
<option value="" selected>--選擇類別--</option>
<% 'dim name1
set rstype=server.createobject("adodb.recordset")
sqltype="select * from newstype"
rstype.open sqltype,conn,1,1
do while not rstype.eof
if typeid=cstr(rstype("typeid")) then
sel="selected"
'name1=rs("type")
else
sel=""
end if
response.write "<option " & sel & " value='"+CStr(rstype("typeID"))+"' name=typeid>"+rstype("type")+"</option>"+chr(13)+chr(10)
rstype.movenext
loop
rstype.close
%>
</select>
<INPUT align=absMiddle border=0 src="../images/search1.gif" type=image>
</TD>
</TR>
</TBODY>
</TABLE><BR>
<TABLE border="0" cellspacing="0" width="100%" cellpadding="0">
<TR>
<TD height=25 align=left bgcolor="#FFCC00"><a href="add.asp?typeid=<%=request("typeid")%>"> 添加<%=name1%><img src="../images/add.gif" alt="錄入新聞數據" border=0 align="absbottom"></a></TD>
</TR>
</TABLE>
<br>
<CENTER>
<TABLE width="100%" border="0" cellpadding="4" cellspacing="1" bgcolor="#336699">
<tr height=25 >
<TD width="45" align="center" background="../images/pics/tile_sub.gif"><font color="#FFFFFF"><b>ID號</b></font></TD>
<TD width="320" align="center" background="../images/pics/tile_sub.gif"><font color="#FFFFFF"><b>新聞標題</b></font></TD>
<TD width="70" align="center" background="../images/pics/tile_sub.gif"><font color="#FFFFFF"><b>包含圖片</b></font></TD>
<TD width="50" align="center" background="../images/pics/tile_sub.gif"><font color="#FFFFFF"><b>預
覽</b></font></TD>
<TD width="55" align="center" background="../images/pics/tile_sub.gif"><font color="#FFFFFF">
<input type='submit' value='刪除'>
</font></TD>
</TR>
<%do while not rs.eof%>
<tr height="20">
<td width="45" height="28" align="center" bgcolor="#ffffff"><font face="Arial"><b><%=rs("newsid")%></b></font></td>
<td width="320" bgcolor="#ffffff"><a href=edit.asp?Newsid=<%=rs("Newsid")%>><%=rs("title")%></a></td>
<td width="70" align="center" bgcolor="#ffffff">
<%if rs("ispic")=1 then%>
<img alt="包含圖片" border="0" src="../images/jinghua.gif">
<%end if%></a>
</td>
<td width="50" align="center" bgcolor="#ffffff"><a href="../../news/shownews.asp?newsid=<%=rs("newsid")%>" target=_blank><img alt="包含圖片" border="0" src="../images/prew.gif"></a></td>
<td width="55" align="center" bgcolor="#ffffff"> <input name='id' type='checkbox' id="id" value='<%=cstr(rs("newsid"))%>'></td>
</tr>
<% i=i+1
if i>=MaxPerPage then exit do
rs.movenext
loop
%>
</table>
</center>
<%
end sub
function showpage(totalnumber,maxperpage,filename)
dim n
if totalnumber mod maxperpage=0 then
n= totalnumber \ maxperpage
else
n= totalnumber \ maxperpage+1
end if
if CurrentPage<2 then
response.write "<table border=0 width=100% cellspacing=0 cellpadding=0 bgcolor=#e8f4ff>"
response.write "<tr height=30>"
response.write "<td align=left>"
response.write "共<font color=#ff6600><b>"&n&"</b></font>頁 第<font color=#ff6600><b>"&CurrentPage&"</b></font>頁 共檢索到<font color=#ff6600><b>"&totalnumber&"</b></font>條相關信息</td>"
response.write "<td align=right>"
response.write "【最前頁】【上一頁】"
else
response.write "<table border=0 width=600 cellspacing=0 cellpadding=0 bgcolor=#e8f4ff>"
response.write "<tr height=30>"
response.write "<td align=left>"
response.write "共<font color=#ff6600><b>"&n&"</b></font>頁 第<font color=#ff6600><b>"&CurrentPage&"</b></font>頁 共檢索到<font color=#ff6600><b>"&totalnumber&"</b></font>條相關信息</td>"
response.write "<td align=right>"
response.write "【<a href="&filename&"?page=1&typeid="&typeid&"&txtitle="&request("txtitle")&">最前頁</a>】"
response.write "【<a href="&filename&"?page="&CurrentPage-1&"&typeid="&typeid&"&txtitle="&request("txtitle")&">上一頁</a>】 "
end if
if n-currentpage<1 then
response.write "【下一頁】【最后頁】"
else
response.write "【<a href="&filename&"?page="&(CurrentPage+1)&"&typeid="&typeid&"&txtitle="&request("txtitle")&">"
response.write "下一頁</a>】【<a href="&filename&"?page="&n&"&typeid="&typeid&"&txtitle="&request("txtitle")&">最后頁</a>】"
end if
response.write "</td>"
response.write "</tr>"
response.write "</table>"
response.write "</form>"
end function
sub deleteannounce(id)
dim rs,sql
set rs=server.createobject("adodb.recordset")
sql="SELECT * from [news] where newsid="&cstr(id)
rs.open sql,conn,1,3
do while not rs.eof
rs.delete
rs.update
rs.movenext
loop
response.Write("<script>alert('刪除成功!');this.location.href='default.asp';</script>")
End sub
%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -