I have looked and looked and can't find out how to fix my code!!
We have to write code to make a slot machine ..
I have started the code based on what he gave us and have tried my hardest to figure out how to complete it but I do not know how to finish it.
I have the images working correctly (kind of.. the second one seems to have problems loading? I dunno what I did to mess that up) and the counter working, but I need to make it add 13 credits when all 3 images are the same. I added code that I thought would work but it's not for some reason that I can't figure out. It should also pop up an alert screen when all 3 are correct and you win. I guess this would have to be including with the if statement and something like alert('You win 12 credits!!!')
Lastly I need to add code that prevents the person from playing when the credit line is 0 (so you can't get - credits!) and I have no idea how to do this.
Any help would be greatly appreciated!
Here's what I have so far!
<title> Slot Machine</title>
// Assumes: slot images are in http://balance3e.com/Images
// Resultes: displays 3 random slot images
var slot1, slot2, slot3;
slot1 = RandomOneOf(['lemon', 'cherry', 'bar']);
slot2 = RandomOneOf(['lemon', 'cherry', 'bar']);
slot3 = RandomOneOf(['lemon', 'cherry', 'bar']);
'http://balance3e.com/Images/' + slot1 + '.jpg';
'http://balance3e.com/Images/' + slot2 + '.jgp';
'http://balance3e.com/Images/' + slot3 + '.jpg';
parseFloat(document.getElementById('credits').innerHTML) - 1;
if (slot1 == slot2 == slot3)
parseFloat(document.getElementById('credits').innerHTML) + 13;
<img id="slot1Img" border=1 alt="slot image"
<img id="slot2Img" border=1 alt="slot image"
<img id="slot3Img" border=1 alt="slot image"
<input type="button" value="Click to Spin" onclick="SpinSlots();">
Credits Remaining: <spin id="credits">20</span>