因此,我在这件事中是新手,我需要每次有人刷新页面时创建随机数
这是我的代码,我不知道要输入什么来在表中获取随机数。有人可以帮忙吗?我希望每当有人刷新页面时都会更改数字。该数字必须有5位数字。
<div>
<br>
</div>
<div class="custd-container custd-bg">
<table class="custd-bg" cellpadding="0" cellspacing="0">
<tr>
<th colspan="12" class="custd-18px custd-bg" style="text-align:center; border-bottom:2px solid #6f5d1a;">LUCKY NUMBER</th>
</tr>
<tr>
<td class="custd-bg" rowspan="2" style="padding-left: 10px;"></td>
<td class="custd-25px custd-center custd-bg" id="custangka">00001</td>
<td style="text-align: center;" class="custd-15px custd-bg">LUCKY</td>
</tr>
<tr>
<td style="padding-right: 10px;" class="custd-bg" colspan="3">
<div class="progress21 progress-moved2 custd-bg" style="padding-left: 3px;">
<div class="progress-bar21 custd-bg" style="padding-left: 3px;"></div>
</div>
</td>
<td class="custd-bg" style="text-align:left; border-right:2px solid #6f5d1a"></td>
<td class="custd-bg" colspan="3" style="padding-left: 7px; padding-right: 10px;">
<div class="progress31 progress-moved11 custd-bg1">
<div class="progress-bar31 custd-bg"></div>
</div>
</td>
<td class="custd-bg" style="text-align:left; border-right:2px solid #6f5d1a"></td>
</tr>
</table>
</div>
我应该怎么办?
Here is my code, i dont know what to input to get random number in my table. Can anyone help please? I want the number to change whenever someone refresh the page. the number must have 5 digits.
<div>
<br>
</div>
<div class="custd-container custd-bg">
<table class="custd-bg" cellpadding="0" cellspacing="0">
<tr>
<th colspan="12" class="custd-18px custd-bg" style="text-align:center; border-bottom:2px solid #6f5d1a;">LUCKY NUMBER</th>
</tr>
<tr>
<td class="custd-bg" rowspan="2" style="padding-left: 10px;"></td>
<td class="custd-25px custd-center custd-bg" id="custangka">00001</td>
<td style="text-align: center;" class="custd-15px custd-bg">LUCKY</td>
</tr>
<tr>
<td style="padding-right: 10px;" class="custd-bg" colspan="3">
<div class="progress21 progress-moved2 custd-bg" style="padding-left: 3px;">
<div class="progress-bar21 custd-bg" style="padding-left: 3px;"></div>
</div>
</td>
<td class="custd-bg" style="text-align:left; border-right:2px solid #6f5d1a"></td>
<td class="custd-bg" colspan="3" style="padding-left: 7px; padding-right: 10px;">
<div class="progress31 progress-moved11 custd-bg1">
<div class="progress-bar31 custd-bg"></div>
</div>
</td>
<td class="custd-bg" style="text-align:left; border-right:2px solid #6f5d1a"></td>
</tr>
</table>
</div>
What should i do?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为了创建随机数,您必须使用JavaScript。
可以生成具有5位数字的随机数,并以ID“ Custangka”这样的ID放入DIV:
该代码部分从 https://www.w3schools.com/js/js_random.asp 。
请注意,此数字是在客户端生成的,因此在加载页面的计算机上。这意味着客户端可以控制数字。
In order to create random numbers you will have to make use of JavaScript.
A random number with 5 digits can be generated and put into the div with id "custangka" like this:
The code is partially taken from https://www.w3schools.com/js/js_random.asp.
Please be aware that this number is generated on the client side, so on the computer that is loading the page. This means that the client can control the number.