arezoo
arezoo

Reputation: 23

how can I make random number with html?

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

Upvotes: 2

Views: 178

Answers (2)

MTCoster
MTCoster

Reputation: 6145

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>

Upvotes: 0

Shahar
Shahar

Reputation: 1677

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

Upvotes: 4

Related Questions