javascript asp教程サーバ対象
3706 ワード
Overview:
The Server Object has seven(7)Methods,one(1)Property,ゼロ(0)Events,andゼロ(0)Collection.
List of Methods:
Server Methods
CreateObject()
Server.reat Object(「ADODB.Recordset」)Create an instance of an Object
Execute()
Server.Execute(「fileName.asp」)Executes an out side file(effect is simiar to SSI)
GetLastError()
Server.GetLastError()Returns location and description of the last ASP error
HTMLEncode()
Server.HTMLEncode(「some String」)Encdes string to HTML characters
MapPath()
Server.MapPath(\\virtual Folder)Coverts virtual path to physical path
Transfer()
Server.Transfer(「fileName.asp」)Trans fers execution out of one page and into another
URLEncode()
Server.URLEncode(「some String」)Encdes string to URL standrds
&噫13;
<!--&菗13;
//override previous functions&{13;
function lesson 2(Section Number、lessonNumber)&
{啝13
var scriptPage=「Section」+Section Number+「/script」+lessonNumber+「.asp」13;
var newwindow 2=window.open(scriptPage、newwindow 2)、config=「height=200、width=640、toolbar=no、menubar=yes、location=no、resizable=yes、scrollbars=yes」
newWindow 2.focus()&唵13;
}&{13;
/-->&菗13;
Below is the script for Lesson 14.
I demostrated four methods in the script 14.asp.We'll Tale them from top to bottom.
Explining the Script:
Server.URLEncode()does exactly what you think it does.It taries a string and encodes it RFC 1738 standars.That's moree ated to know about Server.URLEncode()は、isn't?
Next we have Server.reatObject().In this case I created an instance of the FileSystem Object.The most common oject.es that you will instanciate art.Recordt,Scriptonit.Direpting.Filed.FiledtemtemObject,Systectctionand MSWC.C.contentRotator.The re are many good rorce on all of these created Object.Most of them are beyond the scope of this web site.
Next on the list is Server.MapPath().Looking back at script 14.asp,double the double slashes(\)in the MapPath argment?That's not an accident.We have to use escape characters in JavaScript.
The last Method I demostrate is Server.HTMLEncode().It converts HTML flags into non-HTML equivalents.
The Lone Property:
Server has one property:Script Timeout.It sets the maximnumber of seconnds allowable for script execution.If the script execution exceedth that time,then it it it times out.The user gets ugly message the
The Server Object has seven(7)Methods,one(1)Property,ゼロ(0)Events,andゼロ(0)Collection.
List of Methods:
Server Methods
CreateObject()
Server.reat Object(「ADODB.Recordset」)Create an instance of an Object
Execute()
Server.Execute(「fileName.asp」)Executes an out side file(effect is simiar to SSI)
GetLastError()
Server.GetLastError()Returns location and description of the last ASP error
HTMLEncode()
Server.HTMLEncode(「some String」)Encdes string to HTML characters
MapPath()
Server.MapPath(\\virtual Folder)Coverts virtual path to physical path
Transfer()
Server.Transfer(「fileName.asp」)Trans fers execution out of one page and into another
URLEncode()
Server.URLEncode(「some String」)Encdes string to URL standrds
&噫13;
<!--&菗13;
//override previous functions&{13;
function lesson 2(Section Number、lessonNumber)&
{啝13
var scriptPage=「Section」+Section Number+「/script」+lessonNumber+「.asp」13;
var newwindow 2=window.open(scriptPage、newwindow 2)、config=「height=200、width=640、toolbar=no、menubar=yes、location=no、resizable=yes、scrollbars=yes」
newWindow 2.focus()&唵13;
}&{13;
/-->&菗13;
Below is the script for Lesson 14.
<%@LANGUAGE="JavaScript"%>
<HTML>
<BODY>
<%=Server.URLEncode("Hello, this string is URL Encoded!")%>
<BR><BR>
Now let's see a reprint of Script14a.asp.
I did not type it manually. Instead, I let
Server.CreateObject( ) do all the work.<BR>
<STRONG>
<%
Server.ScriptTimeout=10
var ASPScriptObject = Server.CreateObject("Scripting.FileSystemObject");
var myPath=Server.MapPath("\\") + "\\Section04\\script14a.asp"
var AspScript = ASPScriptObject.OpenTextFile(myPath);
var outputScript="";
while(!AspScript.AtEndOfStream)
{
outputScript += AspScript.ReadLine() + "\r";
}
outputScript = new String(outputScript);
outputScript=Server.HTMLEncode(outputScript)
AspScript.Close();
outputScript = "<PRE>" + outputScript + "</PRE>";
Response.Write(outputScript)
%>
</STRONG>
</BODY>
</HTML>
Click Here to run the script in a new window.I demostrated four methods in the script 14.asp.We'll Tale them from top to bottom.
Explining the Script:
Server.URLEncode()does exactly what you think it does.It taries a string and encodes it RFC 1738 standars.That's moree ated to know about Server.URLEncode()は、isn't?
Next we have Server.reatObject().In this case I created an instance of the FileSystem Object.The most common oject.es that you will instanciate art.Recordt,Scriptonit.Direpting.Filed.FiledtemtemObject,Systectctionand MSWC.C.contentRotator.The re are many good rorce on all of these created Object.Most of them are beyond the scope of this web site.
Next on the list is Server.MapPath().Looking back at script 14.asp,double the double slashes(\)in the MapPath argment?That's not an accident.We have to use escape characters in JavaScript.
The last Method I demostrate is Server.HTMLEncode().It converts HTML flags into non-HTML equivalents.
The Lone Property:
Server has one property:Script Timeout.It sets the maximnumber of seconnds allowable for script execution.If the script execution exceedth that time,then it it it times out.The user gets ugly message the