關閉數據庫連接
sub close_conn
conn.close
set conn = nothing
end sub
關閉實例化數據
sub close_rs
rs.close
set rs = nothing
end sub
彈窗並返回到上一個頁面
sub back(info)
response.write"<script>alert('"&info&"');history.back();</script>"
response.end
end sub
例:
if request.cookies("XXX")("user") = "" then
call back("非法操作!")
end if
彈窗並跳轉至指定頁面
sub location(info,url)
response.write"<script>alert('"&info&"');location.href='"&url&"';</script>"
response.end
end sub
例:
if request.cookies("XXX")("user") <> "" then
call location("登錄成功!","user.asp")
end if
直接跳轉至指定頁面
sub jump(url)
response.write"<script>location.href='"&url&"';</script>"
resonse.end
end sub
例:
if request.cookies("XXX")("user") <> "" then
call jumo("user.asp")
end if
以上都是asp+JavaScript的結合,形成比較整潔的頁面效果。