How to insert a random number generator into an HTML website created via Notepad, in other words: are there any tags for Random?
- You can write a function on JS to create a random number and upload it to an html document - Aliaksandr Pitkevich
- HTML is a markup language. But only. Look in the direction of JS for any manipulations. - MihailPw
|
1 answer
This is not possible in pure HTML. However, without any problems done on js
<script> let num = Math.random() * (max - min) + min; //Π³Π΄Π΅ min ΠΈ max - ΠΌΠΈΠ½ΠΈΠΌΠ°Π»ΡΠ½ΠΎΠ΅ ΠΈ ΠΌΠ°ΠΊΡΠΈΠΌΠ°Π»ΡΠ½ΠΎΠ΅ ΡΠΈΡΠ»ΠΎ Π½Π΅ΠΎΠ±Ρ
ΠΎΠ΄ΠΈΠΌΠΎΠ³ΠΎ Π΄ΠΈΠ°ΠΏΠ°Π·ΠΎΠ½Π° document.getElementById("id").innerHTML = num; //Π³Π΄Π΅ id - ΡΡΠΎ id ΡΠ»Π΅ΠΌΠ΅Π½ΡΠ°, Π² ΠΊΠΎΡΠΎΡΡΠΉ Π½ΡΠΆΠ½ΠΎ Π²ΡΡΠ°Π²ΠΈΡΡ ΠΏΠΎΠ»ΡΡΠΈΠ²ΡΠ΅Π΅ΡΡ ΡΠΈΡΠ»ΠΎ </script> |