Codesupplier.com

free html codes for your website

Random numbers generator

This code produces a simple form buttton, and when clicked a small pop-up window displays a random number from 1 - 10. This code can come in useful for fun like in the example below.

How good are you at running?

Want this code for your website? Copy and paste the following if you do.

<HTML>
<HEAD>
<SCRIPT type="text/javascript"> 
function rand()
      {
          var now=new Date()
          var num=(now.getSeconds())%10
          var num=num+1
          alert(num)
      }
</SCRIPT>
</HEAD>
<BODY>
 <h1>Random Numbers</h1>
 <form>  
   <INPUT TYPE="button" 
   VALUE="Random Number from 1 to 10"  
   onClick="rand()">
 </FORM>
</BODY>
</HTML>

< Go Back to Scripts List