日期:2014-05-17  浏览次数:20932 次

★★★动态变量问题,如a1=,a2=,a3=......a31=★★★
如果给一个动态变量赋值

例如我要一个循环
---------------------------
f=1
do   while   f <=31
        (测试过 "aa "+&f和aa+f两种写法都不对)
f=f+1
loop
----------------------------
要求得到:
a1=1
a2=1
a3=343
....
a31=312
等等
----------------------------

------解决方案--------------------
参考这个:

<SCRIPT LANGUAGE=vbs>
'10行代码实现n个数字全排列
dim n:n=4
dim S
dim w:w=0
for i=1 to n
S=S & "for i " & i & " =1 to n " & chr(13)
next
S=S & " if not( "
for i=1 to n
for j=i to n
if i <> j then S=S & "i " & i & "=i " & j & " or "
next
next
S=left(S,len(S)-4) & ") then " & chr(13)
for i=1 to n
S=S & "document.write i " & i & chr(13)
next
S=S & "document.write " & chr(34) & " <br> " & chr(34) & chr(13) & "end if " & chr(13)
w=w+1
for i=1 to n
S=S & "Next " & chr(13)
next
alert S
execute S
</SCRIPT>