ASP (English full name Active Server Pages) is a programming environment in which HTML, scripting languages, and components can be mixed to create powerful server-side Internet applications. If you have previously created a site that mixed HTML, scripting languages, and components, you can add ASP code to it. Moreover, you can also include some business logic rules through the use of components. Components can be called by scripts or other components. The following lists nineteen basic techniques for using ASP script language:
1. The current date and time command is
The following is a quotation fragment:
<%=now%>
each item request.From("input"))
repomse.write item &"
"
next
%>
Also available" for each x in tewuest.From"Repeatly obtain the input values of all fields.
2. The method for ASP to obtain data input from form (from) is to use a built-in object (object)—Request, which It varies with get and post.
3. If you want to write it yourself in VB or other languages, and the .dll file can be used by ASP, you need to register the DLL file: enter regsbr32 *.dll under DOS.
4. Display five repeated sentences, with the font size getting larger and larger.
The following is a quotation fragment:
<% for i=1 to 5 %>
color=#00ffff>
Fast ASP
<% next %>
5. Send the string to the client
response.write string
The following is a reference fragment:
For example: <% response.write "Welcome" %>
6. Link to the specified URL address
response .redirect url
The following is a reference fragment:
For example: <% response.redirect "homepage.asp">
*But if the content of this .ASP file has been transmitted to the user, An error will occur when redirecting is used again.
7. Combination of other languages and ASP:
The following is a quotation fragment:
For example: Good morning is displayed in the morning, Hello is displayed in the afternoon
<%
if time>+ #12:00:00 AM# and time<#12:00:00 PM
#then
greeting="Good morning!"
else
greeting="Hello!"
end if
%>
<%=greeting %>
8. Application of <script> tag in ASP<br><br>The following is a quotation fragment:<br>Example: <br><html> <br><body> <br><% call function1 %> <br></body> <br></html> <br><script runat=server language=javascript> <br>function function1() <br>{ <br>... <br>} <br></script>
9.#include includes other files
virtual refers to the virtual file address.
file represents the absolute file address.
For example:
The following is a quotation fragment:
And can be nested layer by layer. In addition, #include cannot be within <%--%>.
10. ASP method to obtain form input data: GET POST
1.get: After the client adds the data to the URL, the format is "?Field 1=Input Data 1&Field 2= Enter data 2&..." and then send it to the server.
For example: actionwww.abc.com, the input data in field Name is jack, and the data in field age is 15.
2. Post: The client uses http information data to be transmitted to the server ASP:
Get: Use "input data = Request.QueryString ("field name")", which will be appended to the URL The data is taken out.
Post: Use "input data = Request.Forml" (field name ")" to read the HTTP information data field.
The following is a quotation fragment:
* Request.QueryString example
For example: 〈A hery="aspform.asp?Name=jack&Age=15">
Click here〈/A〉〈p〉
Name:<%=request.QueryString("Name")%)
Age:<%=request.QeueryString("Age")%)
* get Example
·aspturm. asp:
The above is the detailed content of Share 19 basic skills of ASP scripting language. For more information, please follow other related articles on the PHP Chinese website!