|
<HTML>
<HEAD><TITLE>窗体与元素</TITLE></HEAD>
<SCRIPT LANGUAGE="VBScript">
<!--
Sub cmdChange_OnClick
Dim d '创建一个变量
Set d = CreateObject("Scripting.Dictionary")
d.Add "0", "Athens" '添加键和项目
d.Add "1", "Belgrade"
d.Add "2", "Cairo"
For Each I in d
Document.frmForm.Elements(I).Value = D.Item(I)
Next
End Sub
-->
</SCRIPT>
<BODY>
<CENTER>
<FORM NAME="frmForm"
<Input Type = "Text"><p>
<Input Type = "Text"><p>
<Input Type = "Text"><p>
<Input Type = "Text"><p>
<Input Type = "Button" NAME="cmdChange" VALUE="单击此处"><p>
</FORM>
</CENTER>
</BODY>
</HTML>
以上代码中我不明白 For Each I in d
Document.frmForm.Elements(I).Value = D.Item(I)
Next
这段代码,该代码中For Each I in d中的I的取值是dictionary对象的键值0 、1、2,还是项目值呢?D.Item(I)中的“D”是指 Dim d 中的“d”吗?怎么大写了呢? |
|