StaticObjects
ASP StaticObjects 集合
StaticObjects 集合包含所有使用 HTML 的 <object> 标签追加到 application/session 的对象。
语法
Application.StaticObjects(Key)
Session.StaticObjects(Key)
Session.StaticObjects(Key)
参数 | 描述 |
---|---|
key | 必需。要取回的项目的名称。 |
针对 Application 对象的实例
实例 1
循环遍历 StaticObjects 集合:
<%
for each x in Application.StaticObjects
Response.Write(x & "<br>")
next
%>
for each x in Application.StaticObjects
Response.Write(x & "<br>")
next
%>
实例 2
在 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>
在 ASP 文件中:
<%
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
针对 Session 对象的实例:
实例 1
循环遍历 StaticObjects 集合:
<%
for each x in Session.StaticObjects
Response.Write(x & "<br>")
next
%>
for each x in Session.StaticObjects
Response.Write(x & "<br>")
next
%>
实例 2
在 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>
在 ASP 文件中:
<%
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