»
EnglishFrenchVietnamese

Print - Lotto Script - JavaScriptBank.com

Full version: jsB@nk » Game » Lotto Script
URL: https://www.javascriptbank.com/lotto-script.html

Lotto Script © JavaScriptBank.comChuck your superstitions to the side, and put your lottery dreams in this JavaScript instead. Generates 6 random 2-digit numbers for you to use.

Full version: jsB@nk » Game » Lotto Script
URL: https://www.javascriptbank.com/lotto-script.html



JavaScript
<SCRIPT language=javascript>//This script by Peter LeBrun 7-22-00// Produces a lottery gamefunction lotto(){var num1 = Math.round(47 * Math.random());var num2 = Math.round(47 * Math.random());var num3 = Math.round(47 * Math.random());var num4 = Math.round(47 * Math.random());var num5 = Math.round(47 * Math.random());var num6 = Math.round(47 * Math.random());var dofo = document.form;dofo.text7.value = num1;dofo.text8.value = num2;dofo.text9.value = num3;dofo.text10.value = num4;dofo.text11.value = num5;dofo.text12.value = num6;if (dofo.text1.value == num1 && dofo.text2.value == num2 && dofo.text3.value == num3 && dofo.text4.value == num4 && dofo.text5.value == num5 && dofo.text6.value == num6){alert("You Won!")}else{alert("You Lose :(")}}</SCRIPT><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<FORM name=form>Enter a number between 0 and 47:<BR><INPUT size=2 name=text1> <INPUT size=2 name=text2> <INPUT size=2 name=text3> <INPUT size=2 name=text4> <INPUT size=2 name=text5> <INPUT size=2 name=text6><BR><INPUT size=2 name=text7> <INPUT size=2 name=text8> <INPUT size=2 name=text9> <INPUT size=2 name=text10> <INPUT size=2 name=text11> <INPUT size=2 name=text12><BR> <INPUT onclick=lotto() type=button value="Let's Play"></FORM><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->