ASP-Dictionary对象-基础用法

1、存在

dim d
set d=Server.CreateObject("Scripting.Dictionary")
d.Add "c", "China"
d.Add "i", "Italy"
if d.Exists("c")= true then
Response.Write("键存在。")
else
Response.Write("键不存在。")
end if
set d=nothing

2、遍历值

a=d.Items
for i = 0 To d.Count -1
s = s & a(i)
next
Response.Write(s)

3、遍历主键

a=d.Keys
for i = 0 To d.Count -1
s = s & a(i)
next
Response.Write(s)

4、返回值

d.Add "c", "China"
d.Add "i", "Italy"
Response.Write("项目 i 的值是:" & d.item("i"))

5、修改主键

d.Add "c", "China"
d.Add "i", "Italy"
d.Key("i") = "it"
Response.Write("键 i 已设置为 it,其值是:" & d.Item("it"))

6、返回数量

d.Count

7、删除

DictionaryObject.Remove(key)
DictionaryObject.RemoveAll

MySQL存储过程-通过数据库里已存在的IP查询城市

CREATE DEFINER=`mazey`@`%` PROCEDURE `sp_find_city_by_ip`(IN `in_visitor_ip` varchar(20),OUT `out_visitor_city` varchar(100))
BEGIN
select visitor_city into out_visitor_city
from record_visitor
where visitor_ip = in_visitor_ip
and timestampdiff(hour,visitor_time,now())<72
limit 1;
if out_visitor_city is null or out_visitor_city = '' THEN
set out_visitor_city=0;
end if;
END

#测试:

call sp_find_city_by_ip('64.74.215.1',@result);
select @result;

HTML/CSS/JS初始化

CSS
<link type="text/css" href="http://www.mazey.net/css/mazey-base.css" rel="stylesheet" />

jQuery
2.1.1
<script language="javascript" type="text/javascript" src="http://www.mazey.net/js/plugin/jquery/jquery-2.1.1.min.js"></script>

Layer
<script language="javascript" type="text/javascript" src="http://www.mazey.net/js/plugin/layer/layer.js"></script>
<script language="javascript" type="text/javascript" src="http://www.mazey.net/js/plugin/layer/mazey-layer.js"></script>

Bootstrap
<link type="text/css" href="http://www.mazey.net/config/frame/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
<script language="javascript" type="text/javascript" src="http://www.mazey.net/config/frame/bootstrap/js/bootstrap.min.js"></script>

ASP跳出FOR循环

由于ASP不能使用GOTO语句,我在FOR循环中加入一个FOR循环,若需要跳出,即退出最里面那个FOR循环。
DEMO:

<%
dim a
a = 0
for i = 1 to 10
for j = 1 to 1
a = a + 1
if i = 5 then    'a=5不会输出
exit for
end If
Response.write a & "<br/>"
next
next
%>