编程开发 > ASP > 文章内容

ASP中if语句循环的使用方法

2017-4-29编辑:ljnbset

ASP中if语句、select 、while循环的使用方法

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>

"-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

"http://www.w3.org/1999/xhtml">

"Content-Type" content="text/html; charset=gb2312" />

 

<%="多条件判断"%>

<%

response.Write("
"
)

response.Write("利用response对象的Write方法输出地内容!")

 

%>


<%

 

dim a,b

a=200

b=300

response.Write("两数之和为:")

response.Write(a+b)

response.Write("
"
)

if a=100 then

response.Write("a=100,第一个条件满足。")

elseif a=200 then

response.Write("a=200,第二个条件满足。")

elseif a=300 then

response.Write("a=300,第三个条件满足。")

else

response.Write("三个条件都不满足。")

end if

%>

<%

response.Write("
"
)

dim textnumber

textnumber=200

select case textnumber

 case 100

  response.Write("数值为100, 条件满足!")

 case 200

  response.Write("数值为200,条件满足 !")

 case 300

  response.Write("数值为300 ,条件满足!")

 case else

  response.Write("以上条件,条件都不满足!")

 end select

 

 

%>

<%

response.Write("
"
)

dim i,sum

i=0

sum=0

 while i<=100

 sum=sum+i

 i=i+1

wend

response.Write("100以内所有整数的和为:")

response.Write(sum)

%>

<%

response.Write("
"
)

dim w,s

w=0

s=0

do

s=s+w

w=w+1

loop while w<=100

response.Write("100之内的所有整数之和为:")

response.Write(s)

response.Write("
"
)

response.Write("w的值是:")

response.Write(w)

%>

 

ASP中用代替其他语言中的

热点推荐

登录注册
触屏版电脑版网站地图