ASP开发技巧集锦二
作者:cmscn 日期:2005-10-15
11. 报错并返回
if rs.bof and rs.eof then '还是有问题
response.write"<SCRIPT language=JavaScript>alert('找不到!');"
response.write"javascript:history.go(-1)</SCRIPT>"
end if
-----------------------------------
这个是跳转。
<script language="javascript">
alert('<%=intOperationInfo%>');
window.navigate('ChangePwd.asp');
</Script>
12. 从VBS到JS,混用
<%
dim checkpwdconfig
checkpwdconfig=split(addation,"/")
%>
<script language="javascript">
alert("<%=checkpwdconfig(0)%>")
</script>
13. 弹出窗口
<script language=javascript>
function openaddnew()
{
subWindow=window.open("../Edit/PasswordConfigEdit.asp?method=new",'','scrollbars=yes,left=120,top=60,height=250,width=500,menubar=no,location=no,toolbar=no,resizable=yes','')
subWindow.opener = this;
}
</script>
用一个连接调用:
<a href=""#"">请修改密码 onClick="openaddnew()"</a>
图片调用:
<img name=submit1 src="../button_new<%=session("languageid")%>.gif" onClick="openaddnew()">
14. 分页
<!--#include file="conn.asp"-->
<%
if request("pageno")<>"" then
pageno=int(request("pageno"))
else
pageno=1
end if
sql="select * from news where [language]='中文' and bigclassname='新闻' order by id desc"
Set rs= Server.createObject("ADODB.Recordset")
rs.open sql,conn,1,3
rs.pagesize=20
if rs.eof then
pageno=0
else
rs.absolutepage=pageno
end if
%>
==========================================
共<%=rs.recordcount%>条,<%=pageno%>/<%=int(rs.pagecount)%>页,每页<%=rs.pagesize%>条
<a href="manage.asp?pageno=1">首页</a>
<%if pageno>1 then%>
<a href="manage.asp?pageno=<%=int(pageno)-1%>">上一页</a>
<%
end if
if int(pageno)<>int(rs.pagecount)then
%>
<a href="manage.asp?pageno=<%=int(pageno+1)%>">下一页</a>
<%end if%>
<a href="manage.asp?pageno=<%=int(rs.pagecount)%>">尾页</a&am...
if rs.bof and rs.eof then '还是有问题
response.write"<SCRIPT language=JavaScript>alert('找不到!');"
response.write"javascript:history.go(-1)</SCRIPT>"
end if
-----------------------------------
这个是跳转。
<script language="javascript">
alert('<%=intOperationInfo%>');
window.navigate('ChangePwd.asp');
</Script>
12. 从VBS到JS,混用
<%
dim checkpwdconfig
checkpwdconfig=split(addation,"/")
%>
<script language="javascript">
alert("<%=checkpwdconfig(0)%>")
</script>
13. 弹出窗口
<script language=javascript>
function openaddnew()
{
subWindow=window.open("../Edit/PasswordConfigEdit.asp?method=new",'','scrollbars=yes,left=120,top=60,height=250,width=500,menubar=no,location=no,toolbar=no,resizable=yes','')
subWindow.opener = this;
}
</script>
用一个连接调用:
<a href=""#"">请修改密码 onClick="openaddnew()"</a>
图片调用:
<img name=submit1 src="../button_new<%=session("languageid")%>.gif" onClick="openaddnew()">
14. 分页
<!--#include file="conn.asp"-->
<%
if request("pageno")<>"" then
pageno=int(request("pageno"))
else
pageno=1
end if
sql="select * from news where [language]='中文' and bigclassname='新闻' order by id desc"
Set rs= Server.createObject("ADODB.Recordset")
rs.open sql,conn,1,3
rs.pagesize=20
if rs.eof then
pageno=0
else
rs.absolutepage=pageno
end if
%>
==========================================
共<%=rs.recordcount%>条,<%=pageno%>/<%=int(rs.pagecount)%>页,每页<%=rs.pagesize%>条
<a href="manage.asp?pageno=1">首页</a>
<%if pageno>1 then%>
<a href="manage.asp?pageno=<%=int(pageno)-1%>">上一页</a>
<%
end if
if int(pageno)<>int(rs.pagecount)then
%>
<a href="manage.asp?pageno=<%=int(pageno+1)%>">下一页</a>
<%end if%>
<a href="manage.asp?pageno=<%=int(rs.pagecount)%>">尾页</a&am...