无法获得重置按钮以重置锅

时间:2017-05-24 19:33:56

标签: javascript

由于某种原因,我不能让我的重置按钮重置锅我有这个作为我的HTML代码。香港专业教育学院一直在努力,似乎无法弄明白,我很确定我只是缺少一些非常重要的东西

<button id="reset" onClick="reset()"> Reset </button>

这是我的重置按钮系数

的java
var pot = 100;

function pull() {
var slot1 = 0;
var slot2 = 0;
var slot3 = 0;
/*generate 3 random numbers, assign to corresponding img1,
img2,img3, swap images in table */
for (var i = 1; i <= 3; i++) {
    var fruit = Math.floor((Math.random() * 3) + 1);
    document.getElementById(i).src = "img" + fruit + ".gif";
    //assign each of the 3 random numbers to a slot value
if  (i == 1) {
    slot1 = fruit;
 }
else if (i == 2) {
    slot2 = fruit;
 }
 else {
    slot3 = fruit;
 }
}
    //add 25 to the pot if the result is 3 of a kind
if (slot1 == slot2 && slot2 == slot3){
    pot = pot + 25; 
    document.getElementById("awnser").innerHTML = 
    "Jackpot, 3 of a kind! You win $25.00, <br> Pot: $" + pot;
}
//add 10 to pot if the result is a pair
else if (slot1 == slot2 || slot2 == slot3 || slot1 == slot3){
    pot = pot + 10;
    document.getElementById("awnser").innerHTML = "A pair! You win $10.00. 
<br> pot: $" + pot;
}
else {
    pot = pot - 120;
    if (pot <= 0) {
        document.getElementById("awnser").innerHTML = "pot is empty, you are 
  out of cash."
        document.getElementById("stop").disabled = true;
    function reset(){
         pot = pot + 100;
            document.getElementById("reset").reset;             
 }
    }
    else {
    document.getElementById("awnser").innerHTML = "No match! You loose 
  $20.00. <br> Pot: $" + pot;
    }
}
}

0 个答案:

没有答案