javascript asp教程第十一课--Application 对象(2)

Application Methods:

The two Application Methods are Lock() and Unlock(). Lock() blocks all other users from changing the Application variables. Unlock() releases control so that other users can change it. That's important on a larger site where multiple users may be trying to access the same page at the same time.

Application Events:

The two Application events are Application_OnStart() and Application_OnEnd(). These events are accessed in the global.asa. Let's repeat that script from lesson 09.

<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" 
-->

Misc. Items:

Application.Contents has two methods of its own. Application.Contents.Remove("VariableName") and Application.Contents.RemoveAll().

You'll notice there are also Session Events in the global.asa. We'll deal with those in Lesson 12. You'll also notice a call to the ADO Library. We'll talk about that when we get to databases.

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/3359.html