<%@LANGUAGE="JavaScript"%> <% //No ASP Here, just a regular HTML Page %> <HTML> <FORM ACTION="script11a.asp" METHOD="Post"> <STRONG>Would you like to chose the official Application color?</STRONG><BR> <SELECT NAME="OfficialColor"> <OPTION>red</OPTION> <OPTION>white</OPTION> <OPTION>blue</OPTION> </SELECT><BR> <INPUT TYPE="Submit" VALUE="Yes, click here"> </FORM> No, <A HREF="script11a.asp">click here</A>. </HTML>[url=javascript:lesson(]Click Here[/url] to run script11.asp in a new window. Below is script11a.asp.
<%@LANGUAGE="JavaScript"%>
<HTML>
<%
Application.Lock()
var OfficialColor = new String( Request.Form("OfficialColor") )
if (OfficialColor=="red")
{
Application("OfficialColor") = "red"
}
if (OfficialColor=="white")
{
Application("OfficialColor") = "white"
}
if (OfficialColor=="blue")
{
Application("OfficialColor") = "blue"
}
if (OfficialColor=="undefined")
{
//Do nothing. Just leave the color alone.
}
Application.Unlock()
%>
<BODY BGCOLOR="<%=Application("OfficialColor")%>">
<STRONG>
The official application color is <%=Application("OfficialColor")%>.<BR>
</STRONG>
</BODY>
</HTML>
[b]Application Collections:[/b]
The two collections are [i]Contents[/i] and [i]StaticObjects[/i]. StaticObjects come in the form of the <OBJECT> flag. That's done in the global.asa that we saw in Lesson 09. I'll demonstrate it again down below.
By contrast, the Contents collection is demonstrated above. It allows you to set and retrieve variables with Application scope. The format for setting an Application variable is <OBJECT RUNAT=Server SCOPE=Session ID=MyInfo PROGID="MSWC.MyInfo">
</OBJECT>
<SCRIPT RUNAT="Server" LANGUAGE="JavaScript">
function Application_OnStart()
{
Application("someVariableName")="some value"
}
function Application_OnEnd()
{
Application.Contents.RemoveAll()
}
function Session_OnStart()
{
Session.Timeout=15
}
function Session_OnEnd()
{
//Do Nothing
}
</SCRIPT>
<!-- METADATA TYPE="typelib"
FILE="C:\Program Files\Common Files\System\ado\msado15.dll"
-->
[b]Misc. Items:[/b]
Application.Contents has two methods of its own.
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有