vbscript求n的阶乘为什么结果都是1?

来源:百度知道 编辑:UC知道 时间:2024/07/08 15:26:39
<script language="vbscript">
Sub S1_onclick()
s=1
for i=1 to n
s=s*i
next
MsgBox cstr(s)
End Sub
</script>
</head>
<body>
请输入法一个数:
<input type="text" name="T1" />
<input type="button" name="S1" value="确定"/ >
</body>

简单改一下代码:
<script language="vbscript">
Sub S1_onclick()
s=1
for i=1 to document.form1.t1.value
s=s*i
next
MsgBox cstr(s)
End Sub
</script>
</head>
<body>
<form name=form1>
请输入一个数:
<input type="text" name="T1" />
<input type="button" name="S1" value="确定"/ >
</form>
</body>

n的值呢?