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>