教程集 www.jiaochengji.com
教程集 >  脚本编程  >  Asp.net  >  正文 asp 运算符(算术运 比较运 逻辑运算符)

asp 运算符(算术运 比较运 逻辑运算符)

发布时间:2016-09-25   编辑:jiaochengji.com
教程集为您提供asp 运算符(算术运 比较运 逻辑运算符)等资源,欢迎您收藏本站,我们将为您提供最新的asp 运算符(算术运 比较运 逻辑运算符)资源

本文章简介一下asp 运算符(算术运 比较运 逻辑运算符)与运算符的优先级简单代码。


 1.算术运算符
 实例:
  example10.asp
 2.比较运算符
 3.逻辑运算符
 实例:
  example12.asp
 4.运算符的优先级
<%
if request.form("submit") = "提交" then       '用户点击【提交】按钮
 if instr(request.form("str"),"@")<=0 then     'instr函数判断用户输入的字符串中是否包含@字符,如果包含,返回的值是@字符在字符串中第一次出现的位置
  response.write("<script>alert('输入的字符串中不包含@字符')</script>") '不包含,给出提示
 else          '包含,给出提示
  response.write("<script>alert('输入的字符串中包含@字符')</script>")
 end if
end if
%>
<html>
<head>
<meta http-equiv="content-language" content="zh-cn">
<title>example17</title> 
</head>
<body>
 <form method="post" action="example17.asp" name=form1>
  <p align="center">请输入字符串:<input type="text" name="str" size="20"></p>
  <p align="center"><input type="submit" value="提交" name="submit" onclick="check()"><input type="reset" value="重置" name="b2"></p>
 </form>
</body>
</html>

实例二

<script language="vbscript" runat="server">
 sub example18()
  dim varweek    '声明变量
  varweek = weekday(now)                  '获取代表今天是星期几的整数
  response.write("<center>")  '中间对齐
  response.write("<font size=10>") '网页上显示的字体大小
  if varweek=1 then   '添加多个elseif 子句的条件判断
   response.write("今天星期日") '如果是1,网页上显示"今天星期日"
  elseif varweek=2 then
   response.write("今天星期一")
  elseif varweek=3 then
   response.write("今天星期二")
  elseif varweek=4 then
   response.write("今天星期三")
  elseif varweek=5 then
   response.write("今天星期四")
  elseif varweek=6 then
   response.write("今天星期五")
  elseif varweek=7 then
   response.write("今天星期六")
  end if
  response.write("</font>")
end sub
</script>
<html>
<head>
<title>example18</title>
</head>
<body>
<%
 example18
%>
</body>
</html>

您可能感兴趣的文章:
VBScript 运算符
VBScript的运算符
javascript中的逻辑运算符
python中x的平方怎么写
php中运算符的优先级是什么?
javascript的常用运算符
php运算符的优先级是什么?
php 运算符优先级
php中比较常用的特殊运算符号和函数
php运算符及运算符优先级-php入门教程(4)

[关闭]
~ ~