19 basic tips for asp
1. The current date and time command is
<%=now%>
2. The method of ASP obtaining table data input is to use a built-in object—Request,
It varies from get to post.
3. If you want to write it yourself in VB or other language, the .dll file is for use by ASP, you must register the DLL file before: DOS
Enter regsbr32*.dll
4. Show five repetitive sentences, the font is getting bigger and bigger
<%fori=1to5%>
<fontsize=<%=i%>color=#00ffff>
Fast ASP
</font>
<br>
<%next%>
5. Transfer strings to user side
response.writestring
For example: <%response.write"Welcome"%>
6. Link to the specified URL address
response.redirecturl
like:
<%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.
7. Combination of other languages and ASP:
For example: Good morning in the morning, Hello in the afternoon
<%
iftime>+#12:00:00AM#andtime<#12:00:00PM#
Then
greeting="Good morning!"
else
greeting="Hello!"
endif
%>
<%=greeting%>
8. Application of <script> tags in ASP
example:
<html>
<body>
<%callfunction1%>
</body>
</html>
<scriptrunat=serverlanguage=javascript>
functionfunction1()
{
...
}
</script>
9.#include includes other files
<!--#includevirtual|file="filename"-->
virtual refers to the virtual file address.
The file represents the absolute file address.
like:
<!--#includevirtual="/booksamp/test.asp"-->
<!--#includefile="/test/test.asp"-->
And it can be nested layer by layer. In addition #include cannot be within <%--%>
10. Method of obtaining table input data
:GETPOST
1.get: After the user adds the data to the URL, the format is "? Field 1 = input data 1 & Field 2 = input data 2 &...",
Then send it to the server.
If: action is www.abc.com, field Name input data is jack, field age data is 15, then use the get method
http://www.abc.com?Name=jack&Age=15
2.post: The user side uses http information data to transmit to the server
In ASP:
get: Use "Input Data=Request.QueryString("Field Name")" to 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
For example: <Ahery="aspform.asp?Name=jack&Age=15">
Click here 〈/A〉〈p〉
Name:<%=request.QueryString("Name")%)
Age:<%=request.QeueryString("Age")%)
*get example
·aspturm.asp:
<formaction="asp1b.asp"method="get">
Name:<inputtype=textname="input1"value="Yourname">