Version compl�te: jsB@nk » Game » Slot Machine
URL: https://www.javascriptbank.com/slot-machine-index.html
Il s'agit d'un simple 3-Bobine de machine à sous. Les images vont changer comme ils sont filées. Fonctionne avec IE, Netscape et Opera.
Version compl�te: jsB@nk » Game » Slot Machine
URL: https://www.javascriptbank.com/slot-machine-index.html
<script>slotitem = new Array('0','1','2','3','4','5','6','7','8','9');document.slots.bet.focus();startgold=25;document.slots.gold.value=startgold;function stopplay () {if (document.slots.gold.value < startgold) {alert("You lost "+ (startgold-document.slots.gold.value) +" gold pieces. ");}else {alert("You gained "+ (document.slots.gold.value-startgold) +" gold pieces. ");}}function rollem () {if (document.slots.bet.value<1 || document.slots.bet.value == "") {alert("You cannot bet less that 1. "); return;}if (Math.floor(document.slots.gold.value) < Math.floor(document.slots.bet.value)) {alert("Your bet "+document.slots.bet.value+" is larger than your remaining gold "+document.slots.gold.value+". "); return;}if (document.slots.bet.value>1) {document.slots.banner.value="Bet is "+document.slots.bet.value+" gold pieces";}else {document.slots.banner.value="Bet is "+document.slots.bet.value+" gold piece";}counter=0;spinem();}function spinem() {turns1=10+Math.floor((Math.random() * 10))for (a=0;a<turns1;a++){document.slots.slot1.src=""+slotitem[a % 9]+".gif"; }turns2=10+Math.floor((Math.random() * 10))for (b=0;b<turns2;b++){document.slots.slot2.src=""+slotitem[b % 9]+".gif"; }turns3=10+Math.floor((Math.random() * 10))for (c=0;c<turns3;c++){document.slots.slot3.src=""+slotitem[c % 9]+".gif"; }counter++;if (counter<25) {setTimeout("spinem(counter);",50);} else {checkmatch();}}function checkmatch(){ if ((document.slots.slot1.src == document.slots.slot2.src) && (document.slots.slot1.src == document.slots.slot3.src)) {document.slots.banner.value="3 of a kind - You won "+Math.floor(document.slots.bet.value*10)+" gold pieces"; document.slots.gold.value=Math.floor(document.slots.gold.value)+Math.floor(document.slots.bet.value*10); }else if ((document.slots.slot1.src == document.slots.slot2.src) ||(document.slots.slot1.src == document.slots.slot3.src) ||(document.slots.slot2.src == document.slots.slot3.src)){document.slots.banner.value="A pair - You won "+Math.floor(document.slots.bet.value*2)+" gold pieces"; document.slots.gold.value = Math.floor(document.slots.bet.value*2) + Math.floor(document.slots.gold.value);}else {document.slots.gold.value=document.slots.gold.value-document.slots.bet.value; document.slots.banner.value="No match - You lost "+document.slots.bet.value+" gold pieces";}}</script><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->
<form name="slots" onsubmit="rollem(); return false;"><table border="0" cellpadding="3" cellspacing="1" width="300"><tbody><tr><th colspan="2"> Welcome to the Slot Machine! </th></tr><tr><th align="right"> Gold: </th><td align="left"><input type="box" size="5" name="gold" readonly="readonly" value="25"></td></tr><tr><th align="right"> Your bet: </th><td align="left"><input type="box" size="5" name="bet"></td></tr><tr><th><input type="submit" value="Spin the slots"></th><th><input type="button" value="I am done for now" onclick="stopplay();"></th></tr><tr><th colspan="2"> <input type="reset" value="Start over"> </th></tr><tr><td colspan="2"><hr></td></tr><tr><td colspan="2"><center><table cellspacing="5" cellpadding="2" border="0"><tbody><tr><td><img src="1.gif" name="slot1" width="32" height="32"></td><td><img src="2.gif" name="slot2" width="32" height="32"></td><td><img src="3.gif" name="slot3" width="32" height="32"></td></tr></tbody></table><input type="text" readonly="readonly" size="33" name="banner"></center></td></tr><tr><td colspan="2"><hr></td></tr><tr><td colspan="2"><center><table width="100%" border="0"><tbody><tr><th colspan="3"><font size="+1">Payouts</font></th></tr><tr><th> 3 of a kind </th><td> <img src="1.gif" width="32" height="32"> <img src="1.gif" width="32" height="32"> <img src="1.gif" width="32" height="32"> </td><th> 10x your bet </th></tr><tr><th> A pair </th><td> <img src="2.gif" width="32" height="32"> <img src="2.gif" width="32" height="32"> <img src="3.gif" width="32" height="32"> </td><th> 2x your bet </th></tr><tr><th> or </th><td> <img src="0.gif" width="32" height="32"> <img src="4.gif" width="32" height="32"> <img src="4.gif" width="32" height="32"> </td><th> 2x your bet </th></tr><tr><th> or </th><td> <img src="5.gif" width="32" height="32"> <img src="6.gif" width="32" height="32"> <img src="5.gif" width="32" height="32"> </td><th> 2x your bet </th></tr><tr><th> No match </th><td> <img src="7.gif" width="32" height="32"> <img src="8.gif" width="32" height="32"> <img src="9.gif" width="32" height="32"> </td><th> You lose </th></tr></tbody></table></center></td></tr></tbody></table></form><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->
http://javascriptbank.com/javascript/game/Slot_Machine/Slot_Machine_images.zip