首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > ASP >

想加个功能?哪位高手帮帮小弟我多谢了

2012-08-10 
想加个功能?谁帮帮我谢谢了%if session(SjAdminName) thenresponse.Redirect Admin_Login.aspen

想加个功能?谁帮帮我谢谢了
<%
if session("SjAdminName") = "" then
  response.Redirect "Admin_Login.asp"
end if
%>
<!--#include file="conn.asp"-->
<!--#include file="md5.asp"-->
<%
dim rs, sql,iCount
dim Action,FoundErr,ErrMsg
Action=Trim(request("Action"))
%>
<html>
<head>
<title>手机管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="images/Admin_Style.css" rel="stylesheet" type="text/css">
<SCRIPT language=javascript>
function unselectall()
{
  if(document.myform.chkAll.checked){
document.myform.chkAll.checked = document.myform.chkAll.checked&0;
  }
}

function CheckAll(form)
{
  for (var i=0;i<form.elements.length;i++)
  {
  var e = form.elements[i];
  if (e.Name != "chkAll"&&e.disabled!=true)
  e.checked = form.chkAll.checked;
  }
}
</script>
</head>
<body leftmargin="2" topmargin="0" marginwidth="0" marginheight="0">
<table width="63%" border="0" align="center" cellpadding="2" cellspacing="1" class="border">
  <tr class="topbg"> 
  <td height="22" colspan="2" align="center"><strong>手 机 取 料 管 理</strong></td>
  </tr>
  <tr class="tdbg"> 
  <td width="70" height="30"><strong>管理导航:</strong></td>
  <td height="30"><a href="Admin_sj.asp">手机管理首页</a>&nbsp;&nbsp;&nbsp;<a href="Admin_Admin.asp?Action=Add">管理员添加</a>&nbsp;|&nbsp;<a href="Admin_Admin.asp">管理</a>&nbsp;&nbsp;&nbsp;<a href="Admin_Logout.asp">退出管理</a></td>
  </tr>
</table>
<%

if Action="Del" then
call Delsj()
else
call main()
end if
if FoundErr=True then
call WriteErrMsg()
end if
call CloseConn()

sub main()
Set rs=Server.CreateObject("Adodb.RecordSet")
sql="select * from sj order by id"
rs.Open sql,conn,1,1
iCount=rs.recordcount
%>


<div align="center">


<table width='794' border="0" cellpadding="0" cellspacing="0">
<tr><td align="center" width="419" bgcolor="#008000">
<FORM action="http://www.ip138.com:8080/search.asp" method=post name="mobileform" target="_blank">
<INPUT class=tdc name="mobile" maxLength="11" size=20>
<INPUT name="action" type="hidden" value=mobile>
<INPUT class=bdtj name=B1 type=submit value="手机地址查询"> 

</TD>
</form>
<td align="center" width="375" bgcolor="#008000">
<form method=post action="http://www.ip138.com/ips8.asp" name="ipform" target="_blank">
<input type="text" name="ip" size="20"> 
<input type="hidden" name="action" value="2">
<input type="submit" value="IP 地址 查询">

 </TD>
</FORM>
</TR>





  <tr>
  <form name="myform" method="Post" action="Admin_sj.asp" onSubmit="return confirm('确定要删除选中的号码吗?');">


  <td width="794" colspan="2" align="center">
<table width="953" border="0" align="center" cellpadding="2" cellspacing="1" class="border">
  <tr align="center" class="title">
  <td width="39"><strong>选中</strong></td>
  <td height="22" width="287"><strong>手机号码</strong></td>
  <td width="188"><strong>登记时间</strong></td>
  <td width="235"><strong>IP 地 址</strong></td>
  <td width="176" height="22"><strong> 操 作</strong></td>
  </tr>
  <%do while not rs.EOF %>
  <tr align="center" class="tdbg" onMouseOut="this.style.backgroundColor=''" onMouseOver="this.style.backgroundColor='#BFDFFF'"> 
  <td width="39"><input name="ID" type="checkbox" id="ID" value="<%=rs("ID")%>" onClick="unselectall()"></td>
  <td width="287"><font size="3"><a href="http://www.baidu.com/s?wd=<%=rs("sj")%>" target="_blank"><%=rs("sj")%></td>
  <td width="188"><%=rs("time")%></td>
  <td width="235"><a href="http://www.baidu.com/s?wd=<%=rs("ip")%>" target="_blank"><%=rs("ip")%></a></td>
  <td width="176"><%
  response.write "<a href='Admin_sj.asp?Action=Del&ID=" & rs("ID") & "' onClick=""return confirm('确定要删除此号码吗?');"">删除</a>"
%> </td>
  </tr>
  <%
rs.MoveNext
loop
  %>
</table>  
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td width="200" height="30"><input name="chkAll" type="checkbox" id="chkAll" onclick=CheckAll(this.form) value="checkbox">
  选中本页显示的所有手机号码</td>
  <td><input name="Action" type="hidden" id="Action" value="Del">
  <input name="Submit" type="submit" id="Submit" value="删除选中的号码"></td>
  </tr>
</table>
</td>
</form></tr></table>

</div>

<%
rs.Close
set rs=Nothing
end sub

%>
<!--#include file="copyright.asp" -->
</body>
</html>
<%

sub Delsj()
dim sjID
sjID=trim(Request("ID"))
if sjID="" then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>请指定要删除的号码ID</li>"
exit sub
end if
if instr(sjID,",")>0 then
sjID=replace(sjID," ","")
sql="Select * from sj where ID in (" & sjID & ")"
else
sjID=clng(sjID)
sql="select * from sj where ID=" & sjID
end if
Set rs=Server.CreateObject("Adodb.RecordSet")
rs.Open sql,conn,1,3
do while not rs.eof
rs.delete
rs.update
rs.movenext
loop
rs.close
set rs=nothing
call main()
end sub


function RemoveStr(str1,str2)
if isnull(str1) or str1="" then


RemoveStr=""
exit function
end if
if str2="" then
RemoveStr=str1
exit function
end if
if instr(str1,"|")>0 then
dim arrStr,tempStr,i
arrStr=split(str1,"|")
for i=0 to ubound(arrStr)
if arrStr(i)<>str2 then
if tempStr="" then
tempStr=arrStr(i)
else
tempStr=tempStr & "|" & arrStr(i)
end if
end if
next
RemoveStr=tempStr
else
if str1=str2 then
RemoveStr=""
else
RemoveStr=str1
end if
end if
end function
%>






代码如上:我想加一个显示数据库一共有几条数据?或者前面自动显示1.2.3.4这个序列号 删除会自动减这样的

[解决办法]
如果想显示条目序号就在需要显示的地方写 {$i},如果需要显示指定的字段值,就在需要的地方写上 {$FieldName}

热点排行
Bad Request.