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

ASP教程 2025-08-13

这篇文章主要介绍了ASP中if语句、select 、while循环的使用方法,需要的朋友可以参考下

<%@LANGUAGE=VBSCRIPT CODEPAGE=936%><%=页面标题%><%=多条件判断%><%response.Write(
)response.Write(利用response对象的Write方法输出地内容!)%>
<%dim a,ba=200b=300response.Write(两数之和为:)response.Write(a+b)response.Write(
)if a=100 thenresponse.Write(a=100,第一个条件满足。)elseif a=200 thenresponse.Write(a=200,第二个条件满足。)elseif a=300 thenresponse.Write(a=300,第三个条件满足。)elseresponse.Write(三个条件都不满足。)end if%><%response.Write(
)dim textnumbertextnumber=200select 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,sumi=0sum=0 while i<=100 sum=sum+i i=i+1wendresponse.Write(100以内所有整数的和为:)response.Write(sum)%><%response.Write(
)dim w,sw=0s=0do s=s+ww=w+1loop while w<=100response.Write(100之内的所有整数之和为:)response.Write(s)response.Write(
)response.Write(w的值是:)response.Write(w)%>

具体的介绍就不多说了,大家看下实例就可以了


注:相关教程知识阅读请移步到ASP教程频道。