创建网页以显示间隔的数字
有人知道如何制作一个网页显示的数字,例如1至100,当它达到100时,它再次重置为1? 您可以更改数字和数字之间的时间。
使用 html , javascript 或任何需要的东西。 thx :)
does anyone know how to make a WEB PAGE that shows numbers from, for example, 1 to 100 and that when it reaches 100 it resets to 1 again? and that you can change the time between number and number.
Using html, javascript or anything that was needed. Thx :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你的意思是这样吗?
Did you mean something like that?
我不确定我理解你的意思。
如果您只是一个脚本,将数字从1到100次数多次写入,则可以使用:
在它们之间设置延迟可以添加超时:此处如下:
要更改它将编写1-100的次数更改“ Times”的值,目前将其编写比数字少(因此3次)也可以更改。
编辑:啊哈!好,所以这可以做类似的事情:
它将从0到100循环,然后从0再次开始。目前相距1秒(1000 miliseconds)。您可以通过将1000更改为其他东西来或多或少(3000是3秒)。
编辑2:
如果您希望它从1个更改开始:
var i = 0;
到
var i = 1;
如果您希望它或多或少,那么100更改:
如果(i == 100)...
例如,到50是:
如果(i == 50)...
并且再也想不起。因为样式可以在#Somediv上使用CSS。
编辑3:
这将从时钟的当前秒开始启动计数器(1-100)。但是,我不确定每个人都一样,浏览器在某些地方或其他因素中是否加载较慢。
编辑4:
I'm not sure I understand what you mean.
If you mean just a script that writes numbers from 1 to 100 multiple times this can work:
To set delay between them can add timeout like here:
https://www.w3schools.com/jsref/met_win_settimeout.asp
Depending in what way you want that delay, the rest will be different.
To change how many times it will write 1-100 change the value of 'times', currently it will write it 1 time less then the number(so 3 times), can change that as well.
Edit: Aha!Ok so this can do something similar:
It will cycle from 0 to 100, then start from 0 again. Currently its 1 second apart(1000 miliseconds). You can make it more or less by changing the 1000 to something else(3000 will be 3 seconds).
Edit 2:
If you want it to start from 1 change:
var i=0;
to
var i=1;
If you want it to be to more or less then 100 change:
if (i==100)...
to 50 for example would be:
if (i==50)...
And can't think of anything more. For style can use css on #somediv.
Edit 3:
This will start the counter(1-100) from the current seconds of the clock. I'm not sure it will be the same for everyone, though, browser may load slower in some places or other factors.
Edit 4: