Assignment 32: A Possible Answer


function rand()
var now=new Date()
var num=(now.getSeconds())%9

var now2=new Date()
var num2=(now.getMinutes())%9

var now3=new Date()
var num3=(now.getHours())%9

alert("Your Lotto Number Tonight is: " +num+ " " +num2+ " " +num3+ ".")

defaultStatus = "Good Luck!"

<INPUT TYPE="button" VALUE="Show me the Money!" onClick="rand()">



Gives you this:


     Two changes were made to the original script. I lost the "adding one" statement, and used getMinutes() and getHours() for the second two digits.


Did You Get It?


Back to the Index Page