Here I will show you how to make a simple 'Guess The Number' game. It will do fine as your first game!
This goes in the <head>:-
And this in the <body>
<form name="form1"> Enter a number <input type="text" size=5 maxlength=3 name="num"> <input type="button" onClick="guessnum();" value="Enter"> </form>
var num = Math.floor(Math.random() * 101);This is a Mathematical Function Math.Random() is to choose a random number *101 means up to 100 so the numbers will be from 0 to 100 and Math.floor is so to eliminate any decimal points
As Always Feedback is welcome and the full source is attached!!