Recommended: Analyze the dynamic addition of ASP application form and the implementation method and code A request form can contain N items, and when adding the request form, you need to dynamically add the code. Dynamic Table
1. Method for obtaining table input data by ASP: GET POST
1.get: After the user adds the data to the URL, the format is? Field 1=Input data 1& Field 2=Input data 2&..., and then send it to the server. For example: action is www.abc.com, field Name input data is jack, field age data is 15, then use the get method to http://www.abc.com?Name=jack&Age=15
2.post: The user uses http information data to transfer to the server ASP: get: Use input data = Request.QueryString (field name), and extract the data attached to the URL. post: Use input data =Request.Forml (field name), to read the HTTP information data field. * Request.QueryString Example: <A hery=aspform.asp?Name=jack&Age=15> Click here </A>〈p> Name: <%=request.QueryString(Name)%) Age:<%=request.QueueryString(Age)%) * get Example·asp: <form action=asp1b.asp method=get> Name: <input type=text name=input1 value=Your name> <p> Features: <select name=input2> <option>cool! <option>handsome <option>warmhearted </select> <input type=submit value=ok> </form> content of asp1b.asp<html><body> <% =request.querystring(input1) %> hi, your character is <%= request.querystring(input2) %>
</body></html>
2.request.From Syntax: request.From(name)[(index)|.count] name: field name index: When multiple values are entered in the same field, the pointer value index specifies which value of the same field to be read. The range is from 1 to request.From(name).count count: From request.From(name).count, we can know how many values are entered in the name field. If there is no such name field, the count is 0.
As shown in the following example: <% forI=1 to request.fron(input1).count response.write request.From(input1)(I)&<br> next %> If input1 has two values, both display *If index is not used to specify which one to read. Use <% for each item request.From(input)) repomse.write item &<br> next %> You can also use for each x in tewuest.From to repeatedly get the input values of all fields.
The following is the quoted content: <% for each x in request.Form %> request.From (<%=x%)=<%=request.Form (x)%> <br> <% next %> |
3. Methods to obtain the client TCP/IP port: For example: tcp/ip port is <%=request(server_port)%> Use server_port to get the connection port information that receives HTTP request
4. Through the HTTP header information of HTTP_ACCEPT_LANGUAGE, you can get the user's locale. The following example judges the locale of the user and gives different pages. <% language=request.servervariables(HTTP_ACCEPT_LANGUAGE) if language=en then %> <!--#include file=english.asp> <% else %> <!--#include file=china.asp> <% end if%>
5. The current date and time command is <%=now%>
6. The method of ASP to obtain table data input is to use a built-in object—Request, which varies from get and post.
7. If you want to write it yourself in VB or other language, the .dll file for ASP must register the DLL file: enter regsbr32 *.dll under DOS
8. Show five repetitive sentences, with larger and larger fonts <% for i=1 to 5 %> <font size=<% =i %> color=#00ffff> Fast ASP </font> <br> <% next %>
9. Transfer string to the user response.write string, such as: <% response.write Welcome %>
10. Link to the specified URL address response.redirect url, such as: <%response.redirect homepage.asp %>
* However, if the file content of this .ASP has been transferred to the user, an error will occur when redirect is used.
11. Combination of other languages and ASP: For example: Good morning in the morning, Hello 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 %>
12. Examples of <script> tag application in ASP:
The following is the quoted content: <html> <body> <% call function1 %> </body> </html> <script runat=server language=javascript> function function1() { ... } </script> |
13.#include includes other files<!--#include virtual|file=filename--> virtual refers to the virtual file address. file represents the absolute file address. For example: <!--#include virtual=/booksamp/test.asp--> <!--#include file=/test/test.asp-->
And it can be nested layer by layer. In addition, #include cannot be within <%--%>
14. Home page retention period If the user browser browses the home page again within the period of retention of a home page, the home page content originally on the user's hard drive will be displayed. response.expires[=number] where NUMBER is the retention period of the record data box (PAGE BOX), which is minutes. Or: response.expiresabsolute[=[date][time]] For example: Set a home page retention period to a certain day.
15. Connect to the specified URL address. For example: You want to confirm that the user has viewed INDEX.HTM, you can check whether it has been viewed. If it has not been confirmed, it will automatically connect to the homepage <% if not session(BEEN_to_home_page) then response.redirect index.asp end if %>
16.Judge whether to return to this page or enter for the first time <% if user_has_been_here_before then response.write <h3 align=center> Welcome Back again else response.write Welcome! end if %>
17. Display pictures in the database and super connection
The following is the quoted content: <% set conn=server.creatobject(ADODB.connection) conn.open myaddress set rs=conn.execute(select name,tel,url,image from myaddress) %> <p> <tabel> <tr> <% for i=0 to rs.fields.count-1 %> <td> <b> <%=rs(i).name %> |
Share: How to implement the processing of multiple domain names in the same space Take these two domain names as an example: http://www.knowsky.com/http://code.knowsky.com/The two domain names are bound to the same space, ha, but they will jump to different directories. They are not implemented on IIS settings, but just a small piece of ASP code.