javascript asp教程第八课--request对象

Request Object:

Request has five (5) Collections, one (1) Property, and one (1) Method. You'll use the Collections far more than the property or the method.

Request Collections:

Below is a table of the Request Collections and descriptions of how they are used.

Request Collections
ClientCertificate Request.ClientCertificate("Key[Field]")
Client security info for SSL encryption
Cookies Request.Cookies("cookieName")
Holds cookie value stored on the client
Form Request.Form("formName")
Holds value sent via HTML Form
QueryString Request.QueryString("keyName")
Name/Value pair appended to the end of the URL
ServerVariables Request.ServerVariables("variableName")
Hold values sent in the HTTP Headers

ClientCertificate:

Request.ClientCertificate is used with S.S.L. (Secure Sockets Layer). It is beyond the scope of this web site.

Cookies:

We will learn Request.Cookies and Response.Cookies together in Lesson 08. Please be patient.

Form:

Request.Form is probably the workhorse of the Request Collections. The first script is a repeat from Lesson 03.

<%@LANGUAGE="JavaScript"%>
<%
//No ASP Here, just a regular HTML Page
%>
<HTML>
<STRONG>Type something into the text box and submit it.</STRONG>
<FORM ACTION="script08a.asp" METHOD="Post">
<INPUT TYPE="Text" NAME="WebPageVariable"><BR>
<STRONG>How Much Money do you make each month?</STRONG><BR>
<SELECT NAME="monthlySalary">
<OPTION>Under $5,000,000</OPTION>
<OPTION>Above $5,000,000</OPTION>
<OPTION>Nobody's darn business.</OPTION>
</SELECT><BR>
<INPUT TYPE="Submit" VALUE="Submit">
</FORM>
</HTML>

Click Here to run script08.asp in a new window. It posts information to script08a.asp which is found below. In turn, script08a.asp posts information to script08b.asp which is also found below.

<%@LANGUAGE="JavaScript"%>
<%
var WebPageVariable = new String( Request.Form("WebPageVariable") )
WebPageVariable = WebPageVariable.toUpperCase();

var monthlySalary = new String( Request.Form("monthlySalary") )
monthlySalary = monthlySalary.toLowerCase();
%>
<HTML>
The Web Page Variable you typed is: <%=WebPageVariable%> <BR>
The monthly salary you listed is: <%=monthlySalary%> <BR>
<FORM ACTION="script08b.asp" METHOD="Get">
<INPUT TYPE="hidden" VALUE="<%=monthlySalary%>" NAME="QueryVariable">
<STRONG>Click the button to see Query Strings</STRONG><BR>
<INPUT TYPE="submit" VALUE="Submit">
</FORM>
</HTML>

      

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

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