Use Math.random to generate random number : random « Math « JavaScript Tutorial






<html>
<head>
<title>A Simple Page</title>
<script language="JavaScript">
<!--
    alert(Math.random());
//  -->
</script>
</head>
<body>

</body>
</html>








9.21.random
9.21.1.Math.random()
9.21.2.Use Math.random to generate random number
9.21.3.Math.round a random number
9.21.4.Generate a random integer between 2 and 10
9.21.5.Generate random URL
9.21.6.Generate random numbes in a range