【www.gdgbn.com--php常用代码】

For Next循环使用时,你要执行一段代码多次集数。语法如下:
For counter = initial_value to  finite_value [Step increment]
  statements
Next
For语句指定计数器变量及其初步和有限的价值。 Next语句增加了对抗一个变量。可

选的步骤关键字允许增加或减少的值指定计数器变量。

有一个很简单的例子:

<%@ language="vbscript" %>
<%
For i = 0 to 10 Step 2 "use i as a counter
 response.write("The number is " & i & "
")
Next
%>

复杂实例

Select ActionSelect AllTry It<%@ language="vbscript" %>
<%
response.write("

Multiplication table

")
response.write("

For i = 1 to 9             "this is the outer loop
   response.write("")
   response.write("" & i & "")
 
   For j = 2 to 9          "inner loop
        response.write("" & i * j & "")
   Next "repeat the code and move on to the next value of j  

   response.write("")
Next "repeat the code and move on to the next value of i

response.write("")
%>

本文来源:http://www.gdgbn.com/jiaocheng/23630/