Fourth, the sharpener is not misleading Chai Mong --ASP foundation 1. The result (string information) is output to the browser, the syntax is: Response.write displayed. As can be seen from example wuf2.as, "<% = display content%>" can be used instead of "content%>" displayed by "<%" ". 2. Use variables, wuf2.asp can be changed to:
<% @Language = VBScript%> <% 'single quotes After adding Note - WUF3.ASP Option Explicit' requires variable declaration, using it can reduce the possible possible, improve the efficiency DIM ipaddr 'before using variables, IPADDR = Request.SerVariables ("remote_addr")%>
ip address = <% ipaddr%> html> body>1. Use functions in the program
<% @Language = VBScript%> <% response.expires = 0%>
current time: <% = Time%> P>
current time: current time: " & Time & " font> p>%> body> HTML>
In the above example, "&" is equivalent to " ", Date and Time are functions (note: The time available here is the time of the web server instead of the machine where the browser is located, from here the verification the ASP command is in the server End execution), ASP has many other functions, this article cannot be listed one by one, please check it yourself.
As for <% response.expires = 0%>, we know that the browser can cache the web page to accelerate access, and response.expires is used to set the web page to keep the time (minutes) in the client browser cache. If set to 0, it indicates that the web page data will not be retained in the client's cache. It must be placed before the label. In this example, if you don't have this setting, you only press the "Refresh" button, the time will be updated, but only in the address bar, the time will not change, and after this sentence, each knock Enter a time, time will be updated. 4. Use conditional statement:
<% @Language = VBScript%> <% 'wuf5.asp if time <= # 12: 00 # THEN RESPONSE.REDIRECT "WUF1.ASP" elseif Time <= # 18: 00 # THEN Response.Redirect " WUF2.ASP "else response.redirect" wuf3.asp "Endi%> The date is included with ##, response.redirect is responsible for booting the client browser to display a new page, that is, the redirection, remember, this feature is very useful. 5. Use a loop statement:
<% @ Language = vbscript%> <% option explicit%>
<% DIM I while i <= 5 response.write " p>" & "there is other loop structure, such as: do. ..Loop while, "& _" do while ... loop, for ... next, for each ... next, "&" p> "i = i 1 wend%> body> HTML>From the above example, you should pay attention to how to use "_". 6. Use include file.
For a Web site, the top or tail of each page is generally the same, then you can put these identical parts, and then reference it when you need it. First edit a file called comm.asp as follows: