ASP StaticObjects collection
StaticObjects collection contains all use the HTML <object> tag is appended to the application / session objects.
grammar
Application.StaticObjects(Key)
Session.StaticObjects(Key)
Session.StaticObjects(Key)
参数 | 描述 |
---|---|
key | 必需。要取回的项目的名称。 |
For instance Application Object
Example 1
StaticObjects loop through the collection:
<%
for each x in Application.StaticObjects
Response.Write(x & "<br>")
next
%>
for each x in Application.StaticObjects
Response.Write(x & "<br>")
next
%>
Example 2
In the Global.asa:
<object runat="server" scope="application"
id="MsgBoard" progid="msgboard.MsgBoard">
</object>
<object runat="server" scope="application"
id="AdRot" progid="MSWC.AdRotator">
</object>
id="MsgBoard" progid="msgboard.MsgBoard">
</object>
<object runat="server" scope="application"
id="AdRot" progid="MSWC.AdRotator">
</object>
In the ASP file:
<%
for each x in Application.StaticObjects
Response.Write(x & "<br>")
next
%>
输出:
MsgBoard
AdRot
for each x in Application.StaticObjects
Response.Write(x & "<br>")
next
%>
输出:
MsgBoard
AdRot
For instance Session object:
Example 1
StaticObjects loop through the collection:
<%
for each x in Session.StaticObjects
Response.Write(x & "<br>")
next
%>
for each x in Session.StaticObjects
Response.Write(x & "<br>")
next
%>
Example 2
In the Global.asa:
<object runat="server" scope="session"
id="MsgBoard" progid="msgboard.MsgBoard">
</object>
<object runat="server" scope="session"
id="AdRot" progid="MSWC.AdRotator">
</object>
id="MsgBoard" progid="msgboard.MsgBoard">
</object>
<object runat="server" scope="session"
id="AdRot" progid="MSWC.AdRotator">
</object>
In the ASP file:
<%
for each x in Session.StaticObjects
Response.Write(x & "<br>")
next
%>
输出:
MsgBoard
AdRot
for each x in Session.StaticObjects
Response.Write(x & "<br>")
next
%>
输出:
MsgBoard
AdRot
Complete Application Object Reference