simple slot machine

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lyodmichael
    New Member
    • Jul 2012
    • 75

    #1

    simple slot machine

    i need some help in my code :) , i don't know how to arange the code properly :) .
    Code:
    <html>
    <title>clagmay_shuffle</title>
    <body>
    <form>
    <input type="button" value="" id="btn1"/>
    
    <input type="button" value="" id="btn2"/>
    
    <input type="button" value="" id="btn3"/>
    
    <input type="button" value="shuffle" name="btn" onclick="shuffle()"/>
    </form>
    <script type="text/javascript">
    
    
    function shuffle(){
    
    
    var x = document.getElementById('btn1').value=Math.floor(Math.random()*6)+1,
    y = document.getElementById('btn2').value=Math.floor(Math.random()*6)+1,
    z = document.getElementById('btn3').value=Math.floor(Math.random()*6)+1, i=0;
    
    
    for setTimeout(function(x,y,z;i++){
    {
    if (x=y,z)
    {
    alert("wow");
    
    }
    continue;
    
    }
    
    
    },90);
    
    
    }
    
    </script>
    </body>
    </html>
    this is my first time to study java :) .
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    this is my first time to study java :)
    then you’re in the wrong class, this is JavaScript. It has only the first four letters in common with Java.

    besides that, from line #24 there is pretty much everything wrong.

    Comment

    • lyodmichael
      New Member
      • Jul 2012
      • 75

      #3
      i know but i dont know how to combined the timeout and looping in the same time,

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #4
        that’s simple. you don’t. recursion (using setTimeout()) doesn’t need a loop.

        Comment

        Working...