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>
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>
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>
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>
<a href=””#””>请修改密码 onclick=”openaddnew()”</a>
图片调用:
<img name=submit1 src=”../button_new<%=session(“languageid”)%>.gif” onclick=”openaddnew()”>
<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
<%
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>
<%rs.close%>
<%
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>
<%rs.close%>
<%
call closeconn()
%>
%>
15. 数据库更新
sql=”select * from [user] where username=”&request(“username”)&””
rs.open sql,conn,1,3
rs(“usermail”)=request(“usermail”)
rs(“userhome”)=request(“userhome”))
rs.update
rs.close
rs.open sql,conn,1,3
rs(“usermail”)=request(“usermail”)
rs(“userhome”)=request(“userhome”))
rs.update
rs.close
16. 关闭独立窗口
<head>
<object id=closes type=”application/x-oleobject” classid=”clsid:adb880a6-d8ff- 11cf-9377-00aa003b7a11″><param name=”command” value=”close”>
</object>
</head>
<body>
<input type=”button” value=”点击我关闭窗口” onclick=”closes.click();”>
</body>
<object id=closes type=”application/x-oleobject” classid=”clsid:adb880a6-d8ff- 11cf-9377-00aa003b7a11″><param name=”command” value=”close”>
</object>
</head>
<body>
<input type=”button” value=”点击我关闭窗口” onclick=”closes.click();”>
</body>
17. 极细表格
<table border=”1″ cellpadding=”0″ cellspacing=”0″ width=”32″ height=”32″ bordercolorlight=”#000000″ bordercolordark=”#ffffff”>
<tr>
<td> </td>
</tr>
</table>
<tr>
<td> </td>
</tr>
</table>
18. 几个正则表达式
require : /.+/,
email : /^\w+([-+.]\w+)*@\w+([-.]\\w+)*\.\w+([-.]\w+)*$/,
phone : /^((\(\d{3}\))|(\d{3}\-))?(\(0\d{2,3}\)|0\d{2,3}-)?[1-9]\d{6,7}$/,
mobile : /^((\(\d{3}\))|(\d{3}\-))?13\d{9}$/,
url : /^http:\/\/[a-za-z0-9]+\.[a-za-z0-9]+[\/=\?%\-&_~`@[\]\:+!]*([^<>\”\”])*$/,
idcard : /^\d{15}(\d{2}[a-za-z0-9])?$/,
currency : /^\d+(\.\d+)?$/,
number : /^\d+$/,
zip : /^[1-9]\d{5}$/,
qq : /^[1-9]\d{4,8}$/,
integer : /^[-\+]?\d+$/,
double : /^[-\+]?\d+(\.\d+)?$/,
english : /^[a-za-z]+$/,
chinese : /^[\u0391-\uffe5]+$/,
unsafe :/^(([a-z]*|[a-z]*|\d*|[-_\~!@#\$%\^&\*\.\(\)\[\]\{\}<>\?\\\/\\”]*)|.{0,5})$|\s/,
email : /^\w+([-+.]\w+)*@\w+([-.]\\w+)*\.\w+([-.]\w+)*$/,
phone : /^((\(\d{3}\))|(\d{3}\-))?(\(0\d{2,3}\)|0\d{2,3}-)?[1-9]\d{6,7}$/,
mobile : /^((\(\d{3}\))|(\d{3}\-))?13\d{9}$/,
url : /^http:\/\/[a-za-z0-9]+\.[a-za-z0-9]+[\/=\?%\-&_~`@[\]\:+!]*([^<>\”\”])*$/,
idcard : /^\d{15}(\d{2}[a-za-z0-9])?$/,
currency : /^\d+(\.\d+)?$/,
number : /^\d+$/,
zip : /^[1-9]\d{5}$/,
qq : /^[1-9]\d{4,8}$/,
integer : /^[-\+]?\d+$/,
double : /^[-\+]?\d+(\.\d+)?$/,
english : /^[a-za-z]+$/,
chinese : /^[\u0391-\uffe5]+$/,
unsafe :/^(([a-z]*|[a-z]*|\d*|[-_\~!@#\$%\^&\*\.\(\)\[\]\{\}<>\?\\\/\\”]*)|.{0,5})$|\s/,
19. left应用(控制字数)
function title(str)
if len(trim(str))>=28 then
title=left(trim(str),27)&”…”
else
title=trim(str)
end if
end function
if len(trim(str))>=28 then
title=left(trim(str),27)&”…”
else
title=trim(str)
end if
end function
20. 判断浏览器
<script language=”javascript1.2″>
<!–//
if (navigator.appname == netscape)
var language = navigator.language;
else
var language = navigator.browserlanguage;
if (language.indexof(en) > -1) document.location.href = en/index.asp;
else if (language.indexof(zh) > -1) document.location.href = cn/index.asp;
else
document.location.href = cn/index.asp;
// end –>
</script>
<!–//
if (navigator.appname == netscape)
var language = navigator.language;
else
var language = navigator.browserlanguage;
if (language.indexof(en) > -1) document.location.href = en/index.asp;
else if (language.indexof(zh) > -1) document.location.href = cn/index.asp;
else
document.location.href = cn/index.asp;
// end –>
</script>