ASP operators (Arithmetic transport logical operators)

Source: Internet
Author: User

This article introduces a simple code for the precedence of the ASP operator (arithmetic transport comparison logical operator) and operator.


1. Arithmetic operators
Instance:
Example10.asp
2. Comparison operators
3. logical operators
Instance:
Example12.asp
4. Precedence of Operators
<%
If Request.Form ("submit") = "Submit" then user click "Submit" button
If InStr (Request.Form ("str"), "@") <=0 Then ' InStr function to determine if the string entered by the user contains the @ character, and if so, the value returned is the first occurrence of the @ character in the string
Response.Write (' <script>alert (' input string does not contain @ character ') ' </script> ' is not included, give a hint
Else ' contain, give a hint
Response.Write (<script>alert (' input string contains @ character ') </script> ")
End If
End If
%>
<meta http-equiv= "Content-language" content= "ZH-CN" >
<title>example17</title>
<body>
<form method= "POST" action= "example17.asp" name=form1>
<p align= "center" > Please input string: <input type= "text" name= "str" size= "></p>"
<p align= "center" ><input type= "Submit" value= "submitted" name= "Submission" onclick= "Check ()" ><input type= "reset" value= "Reset" name= "B2" ></p>
</form>
</body>

Example Two

<script language= "VBScript" runat= "Server" >
Sub Example18 ()
Dim Varweek ' Declare variable
Varweek = Weekday (now) gets an integer representing the day of the week
Response.Write ("<center>") ' Middle alignment
Response.Write ("<font size=10>") ' font size displayed on the Web page
If Varweek=1 then ' the conditional judgment of adding multiple elseif clauses
Response.Write ("Today Sunday") ' If it is 1, the page shows "Today Sunday"
ElseIf varweek=2 Then
Response.Write ("Today Monday")
ElseIf Varweek=3 Then
Response.Write ("Today Tuesday")
ElseIf Varweek=4 Then
Response.Write ("Today Wednesday")
ElseIf Varweek=5 Then
Response.Write ("Today Thursday")
ElseIf Varweek=6 Then
Response.Write ("Today Friday")
ElseIf Varweek=7 Then
Response.Write ("Today Saturday")
End If
Response.Write ("</font>")
End Sub
</script>
<title>example18</title>
<body>
<%
Example18
%>
</body>

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.