? Number of Sides on Dice
<script>
//Julio Maravilla Oct 4 2007
var dieNum;
var roll;
alert("In this program i am going to roll a dice for you that has as many sides as you want, as long as that its between 1 and 50.");
dieNum= prompt("How many sides would you like on your dice?");
dieNum=eval(dieNum);
if(dieNum>0)
{
if(dieNum <50)
{
roll=Math.floor(Math.random() * dieNum) +1;
alert("You rolled a die with " + dieNum + " sides");
alert("You rolled a " + roll + " ! =D");
}
else
{
alert("Follow directions!!!! Pick a number higher then 1, but less then 50!!!");
}
}
else
{
alert("Follow directions!!!! Pick a number higher then 1, but less then 50!!!");
}
</Script>
|
|