分类

学习笔记 [17]
渗透测试 [4]
一些杂文 [14]
coding [16]
漏洞信息 [17]
技术文章 [15]
开发文档 [8]
个人作品 [5]
PS:个人作品在各种下载栏目均有下载

站内搜索

日历

«  August 2010  »
Su Mo Tu We Th Fr Sa
1234567
891011121314
15161718192021
22232425262728
293031

访问统计(起于2010/10/2)

访问统计
PortWatcher's Blog
Monday, 2025-06-30, 4:09 AM
Welcome Guest
Main | Registration | Login | RSS

Blog

Main » 2010 » August » 19 » 有关ASP中Dictionary对象Keys方法的一个小问题
9:20 PM
有关ASP中Dictionary对象Keys方法的一个小问题
最近在系统地认真地学习ASP````看以下例子````

Code

<%
dim d,a,i
set d=Server.CreateObject("Scripting.Dictionary")
d.Add "n","Norway"
d.Add "i","Italy"
d.Add "s","Sweden"

Response.Write("

Key values:</p>")
a=d.Keys
for i=0 to d.Count-1
  Response.Write(a(i))
  Response.Write("
")
next

set d=nothing
%>

Output:

Key values:

n
i
s
==================================================================

为什么要用一个中间变量a让我困惑很久```在本地测试了一下````

Code

<%
dim d,a,i
set d=Server.CreateObject("Scripting.Dictionary")
d.Add "n","Norway"
d.Add "i","Italy"
d.Add "s","Sweden"

Response.Write("

Key values:</p>")
for i=0 to d.Count-1
  Response.Write(d.Keys(i))
  Response.Write("
")
next

set d=nothing
%>

Output:
Key values:

Microsoft VBScript 运行时错误 '800a01c3'

对象不是一个集合: 'Keys'

\wwwroot\test.asp, line 10

====================================================================

再做一个测试`````

=====================================================================

Code

<%
dim d,a,i
set d=Server.CreateObject("Scripting.Dictionary")
d.Add "n","Norway"
d.Add "i","Italy"
d.Add "s","Sweden"

Response.Write("

Key values:</p>")
a = d.Keys(i)
for i=0 to d.Count-1
  Response.Write(a)
  Response.Write("
")
next

set d=nothing
%>

Key values:

Microsoft VBScript 运行时错误 '800a01c3'

对象不是一个集合: 'Keys'

\wwwroot\test.asp, line 9

================================================================

问了下OnlyLonely大牛```他解决了我的困惑````
原因很简单```Keys方法不支持带参数调用````
ASP没有重载的概念,不能像JavaScript那样直接操纵DOM````

唉```计算机科班的人说话就是专业啊```
因为一直都在自学```所以知识有很多漏洞是肯定的````没办法谁叫我才1X岁````

继续加油吧````

Category: 学习笔记 | Views: 668 | Added by: Jury | Rating: 3.0/1
Total comments: 0
Name *:
Email *:
Code *: