19 Basic Tips for ASP (1)

Source: Internet
Author: User
Skill 1. Now the date Time command is


<%=now%> can


  

The
2.ASP method for obtaining data entry in form (from) is to use one of the built-in objects (object)-requect,


it varies by get,post.


  


3. If you want to write yourself in VB or other languages, the. dll file can be used by the ASP to register the DLL: DOS under


input Regsbr32 *.dll


  


4. Show five repeating sentences, the font is getting bigger


<% for I=1 to 5%>


<font size=<% =i%> color= #00ffff >


Fast ASP


</font>


<br>


<% Next%>


  


5. Transmit string to client


Response.Write String


such as: <% Response.Write "Welcome"%>


  


6. Link to the specified URL address


Response.Redirect URL


such as:


<% Response.Redirect "homepage.asp"


%>


  


* But if this. The ASP's file content has been routed to the user, and then an error occurs when the redirect is used.


  


7. Integration of other languages with asp:


such as: Good Morning show, afternoon show Hello


<%


if time>+ #12:00:00 am# and time< #12:00:00 PM #


then


greeting= "Good morning!"


Else


greeting= "Hello!"


End If


%>


<%=greeting%>


  

Application of
8.<script> tag in ASP


Example:


  


<html>


<body>


<% call function1%>


</body>


</html>


<script runat=server language=javascript>


function function1 ()


  {


  ...


  }


</script>


  


9. #include including other documents


<!--#include virtual|file= "filename"-->


virtual refers to a fictitious file address.


file represents an absolute filename address.


such as:


<!--#include virtual= "/booksamp/test.asp"-->


<!--#include file= "/test/test.asp"-->


  


and can be nested in layers. In addition, #include cannot be
within <%--%>

  


10.ASP method to obtain form input data


: Get POST


A. Get: The client adds the data to the URL after the format is "? Field 1 = input data 1&amp; field 2 = input data 2&amp ... ",


is then sent to the server.


such as: Action for www.abc.com, field name input data for Jack, Field age data is 15, then use the Get method for


http://www.abc.com?Name=jack&amp;Age=15


  


two. Post: The client is routed to the server using HTTP information data


asp:


get: Use the input data = request.querystring (field name) to remove the data attached to the URL.


Post: Use the "Enter Data =request.forml" (Field name ")" to read the HTTP information data fields.


* Request.QueryString Paradigm


such as: 〈a hery= "aspform.asp?" Name=jack&amp;age=15 "&gt;


Press This 〈/a〉〈p〉


Name:&lt;%=request. QueryString ("Name")%)


Age:&lt;%=request. Qeuerystring ("age")%)


* Get Example


aspturm.asp:


&lt;form action= "asp1b.asp" method= "get" &gt;


Name: &lt;input type=text name= "input1" value= "Your name" &gt;


&lt;p&gt;


Features: &lt;select name= "Input2" &gt;


&lt;option&gt;cool!


&lt;option&gt;handsome


&lt;option&gt;warmhearted


&lt;/select&gt;


&lt;input type=submit value= "OK" &gt;


&lt;/form&gt;

The content of
asp1b.asp


&lt;html&gt;&lt;body&gt;


&lt;% =request.querystring ("input1")%&gt; Hi, your character is


&lt;%= request.querystring ("Input2")%&gt;


&lt;/body&gt;&lt;/html&gt;


11.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 the value to read the same field, ranging from 1 to


request. From (name). Count


count: By request. The From (name). Count know the Name field to enter several values, without this name field, Count is 0





Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.