var numPetals = 12; //stores the correct answer function rollEm(){ // petals around the rose // nick shelby // an adaption of an old dice game // requires that a document named "output" is availible var theSource =""; var roll = 0; var guess = 999;//stores the user's guess //check user's guess guess = eval(document.myForm.txtGuess.value); if (guess == numPetals){ theSource += ""; theSource += "
Make your own free website on Tripod.com
"; theSource += "
"; theSource += "

You Win!!!

"; theSource += ""; document.myForm.txtGuess.value = ""; } else { alert("there are " + numPetals + " petals around the rose."); numPetals = 0; document.myForm.txtGuess.value = ""; theSource += ""; theSource += ""; theSource += "
"; theSource += "



"; for (i = 1; i <= 5; i++){ roll = Math.floor(Math.random() * 6) + 1; switch (roll){ case 1: theSource += " "; break; case 2: theSource += " "; break; case 3 : theSource += " "; numPetals += 2; break; case 4: theSource += " "; break; case 5: theSource += " "; numPetals += 4; break; case 6: theSource += " "; break; default : theSource += "ERROR!!"; } // end switch } // end loop } // end if theSource +="
"; theSource +=""; theSource +=""; window.parent.output.document.open(); window.parent.output.document.write(theSource); window.parent.output.document.close(); }// end rollem function helpScreen(){ //pop up a new window with a help screen in it //requires petalHelp.html var helpWindow = window.open("petalHelp.html", "pHelp", "height=450,width=450"); helpWindow.focus(); } // end helpScreen

Petals around the rose?