我是 VBscript 的新手,我想找出给定数字的阶乘。我正在使用此代码。这将显示按钮但是当点击按钮时什么都不会发生。请帮我。
<html>
<head>
<script type="text/vbscript">
sub fact
n=cint(inputbox("Enter a number"))
dim f
f=1
if n<0 then
msgbox "Invalid number"
elseif n=0 or n=1 then
msgbox "The factorial of given number "&n&" is :"&f
else
for i=n to 2 step -1
f=f*i
next
msgbox "The factorial of given number "&n&" is :"&f
end if
end sub
</script>
</head>
<body>
<input type="button" onclick= "fact()" value="Factorial">
</body>