2

I want to make random numbers with html Is there any way for this? the function of java script for this is .random(); but I want just use html

2 Answers 2

4

You can't, you have to use JavaScript Math.random().

Sign up to request clarification or add additional context in comments.

2 Comments

are you sure? I heard html has this posibility
@arezoo You heard wrong, HTML was never intended to do any forms of computations.
0

HTML is just a way of describing the content and layout of a page. In order to add dynamic content or interactivity, it is necessary to use JavaScript.

In this instance:

window.onload = function() {
  document.getElementById("random-number").innerHTML = Math.random(); 
};
<div id="random-number"></div>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.