使用 VBS 倒计时 asp
Countdown asp using VBS
我正在尝试制作一个倒计时页面,它应该显示每个计数的数字,它从用户输入中获取数字,在 table.
中
最后会显示例如从10到1,数字10,9,8,7,6,5,4,3,2,1。
与此同时,我得到结果,但仅用于递增计数,但我如何让它进行递减计数,它进入我的循环但它只显示第一个数字,我如何显示其余数字?
<%
response.flush
l_start = request.querystring("f_start")
l_goal = request.querystring("f_goal")
%>
<form action = "countdown.asp" method = "get">
<h1 align = "center">Dies ist ein Zähler!<h1>
<table border = "1" align = "center">
<tr>
<td>
Bitte einen Startwert eingeben.
</td>
<td>
<input type = "number" name = "f_start" value = "<%=l_start%>"
</td>
<td width = "100">
</td>
<td>
Bitte einen Zielwert eingeben.
</td>
<td>
<input type = "number" name = "f_goal" value = "<%=l_goal%>"
</td>
<td>
<input type = "submit" value = "Go!" \>
</td>
</tr>
<tr>
<td>
Gezählte Zahlen:
</td>
<td>
<%
if request.querystring(("f_start")) < request.querystring(("f_goal")) then
For i = l_start To l_goal
response.write("" & i & ",")
Next
else
counter = l_start
while counter > l_goal
response.write(counter)
response.write(",")
counter = l_start - 1
wend
end if
%>
</td>
</tr>
</table>
</form>
这里有很多错误。首先,如果 f_start
大于 f_goal
,你只进入 if
语句的 then
子句,然后你只进入 while
的主体如果 f_start
小于或等于 f_goal
。 else
子句的条件类似。
但比这更糟糕,因为您使用了未定义的名为 f_start
、f_goal
和 f_count
的变量。我认为您打算使用 Request.QueryString
中的值,但这不是您正在做的。
您为 l_start
、l_goal
和 l_count
赋值但从未更改它们。您修改了 x
和 y
中的值,但从不使用它们。您将未更改的 l_start
和 l_goal
放回表格中。
最后,您对这段代码的执行位置以及脚本中的变量如何与表单相关的理解似乎存在认知脱节。这是在服务器上执行的。您在表单中输入的值将提交给服务器。该脚本运行并且不对从表单传递给它的值做任何事情。然后它将这些值直接放回到表单中。
我正在尝试制作一个倒计时页面,它应该显示每个计数的数字,它从用户输入中获取数字,在 table.
中最后会显示例如从10到1,数字10,9,8,7,6,5,4,3,2,1。
与此同时,我得到结果,但仅用于递增计数,但我如何让它进行递减计数,它进入我的循环但它只显示第一个数字,我如何显示其余数字?
<%
response.flush
l_start = request.querystring("f_start")
l_goal = request.querystring("f_goal")
%>
<form action = "countdown.asp" method = "get">
<h1 align = "center">Dies ist ein Zähler!<h1>
<table border = "1" align = "center">
<tr>
<td>
Bitte einen Startwert eingeben.
</td>
<td>
<input type = "number" name = "f_start" value = "<%=l_start%>"
</td>
<td width = "100">
</td>
<td>
Bitte einen Zielwert eingeben.
</td>
<td>
<input type = "number" name = "f_goal" value = "<%=l_goal%>"
</td>
<td>
<input type = "submit" value = "Go!" \>
</td>
</tr>
<tr>
<td>
Gezählte Zahlen:
</td>
<td>
<%
if request.querystring(("f_start")) < request.querystring(("f_goal")) then
For i = l_start To l_goal
response.write("" & i & ",")
Next
else
counter = l_start
while counter > l_goal
response.write(counter)
response.write(",")
counter = l_start - 1
wend
end if
%>
</td>
</tr>
</table>
</form>
这里有很多错误。首先,如果 f_start
大于 f_goal
,你只进入 if
语句的 then
子句,然后你只进入 while
的主体如果 f_start
小于或等于 f_goal
。 else
子句的条件类似。
但比这更糟糕,因为您使用了未定义的名为 f_start
、f_goal
和 f_count
的变量。我认为您打算使用 Request.QueryString
中的值,但这不是您正在做的。
您为 l_start
、l_goal
和 l_count
赋值但从未更改它们。您修改了 x
和 y
中的值,但从不使用它们。您将未更改的 l_start
和 l_goal
放回表格中。
最后,您对这段代码的执行位置以及脚本中的变量如何与表单相关的理解似乎存在认知脱节。这是在服务器上执行的。您在表单中输入的值将提交给服务器。该脚本运行并且不对从表单传递给它的值做任何事情。然后它将这些值直接放回到表单中。