logo
Ryan's Webpage
 

 

><html>
<body>
<script>
// by Ryan Te
// 10/5/07
// this program asks how many sides of the dice the user wants to roll
var dieNumber;
var roll;

alert("This program lets you decide how many sides of the dice you want, rolls, then returns the result.(1-6)");
dieNum= prompt("How many sides would you like on your dice?(Must be 1-6)");
dieNum=eval(dieNum);

if(dieNum>0)
{
if(dieNum <7)
{
roll=Math.floor(Math.random() * dieNum) +1;
alert("You rolled a die with " + dieNum + " sides");
alert("You rolled a " + roll + " ! =D");

}
else
{
alert("ERROR choose a number 1-6");
}
}
else
{
alert("ERROR choose a number 1-6");
}
</Script>
</body>
</html>

 

Contact Me

 

Mr. Styner's Webpage

 

Peter

Julie

Nick

Tiddus

Norman