I didnt remember what the document.write thing was for in the for loop and I also wasnt sure what the code would be to get the numbers guessed from the text box to compare them with the random number. I know something else is wrong to, but Im not sure what. Im a total newbie at this stuff. This is what I have so far:

function startGame ( )
{
var ranNum = Math.floor((Math.random()*50)+1);
document.getElementById("t1").value = ranNum
var i=0;
for (i=0;i<=10;i++)
{
document.write("Hello" + i + "<br>");
}
var answer = prompt("Guess a number between 1 and 50!");
if(answer > random)
{
alert("Guess lower!");
continue;
}
else if(answer < random)
{
alert("Guess higher!!");
continue;
}
else if(answer==random)
{
alert("Correct!");
break;
}
}

</script>
</head>
<body>
<form name="aform" id="aform">
<strong> Guess a random number </strong>
<input type="text" name="t1" id="t1">
<input type="button" name="b1" id="b1" value="Generate random number"
onclick="startGame()">