如何让几个带通话功能的按钮都起作用

How to make several buttons with call functions all work

我正在尝试使用多个按钮,每个按钮都有一个单独的呼叫功能,但要么所有按钮都做同样的事情,要么 none 个按钮都起作用。 所以这是我的第一个按钮:

<button id="study" onclick="call();">Study</button>

这是它的脚本:

var callCount = 0;

function one() {
   changeImage1('Call one');
   {
    var img = document.getElementById("image");
    img.src="images/tumblr_dash.gif";
   document.getElementById("action").innerHTML = "You have decided to study";
   }
}

function two() {
   changeImage2('Call two');
   {
   var img = document.getElementById("image");
   img.src="images/tumblr_dash.gif";
   document.getElementById("action").innerHTML = "You have decided to start studying in a minute";
   }
}
function three() {
   changeImage3('Call three');
   {
   var img = document.getElementById("image");
   img.src="images/study.gif";
   document.getElementById("action").innerHTML = "You are currently studying";
   }
}

function call(){
  callCount++;
  var btn = document.getElementById('study');
   if(callCount == 1) one();
   else if(callCount == 2) two();
  else if(callCount == 3) three();
  else btn.disabled = true;

  //callOne = false /*!callOne;*/
}

而且效果很好。但是当我输入第二个按钮时:

<button id="eat" onclick="call1();">Eat</button>

其中有这个脚本:

var callCount1 = 0;

function one1() {
   changeImage1('Call one');
   {
    var img = document.getElementById("image");
    img.src="images/tumblr_dash.gif";
   document.getElementById("action").innerHTML = "You have decided to study";
   }
}

function two1() {
   changeImage2('Call two');
   {
   var img = document.getElementById("image");
   img.src="images/tumblr_dash.gif";
   document.getElementById("action").innerHTML = "You have decided to start eating in a minute";
   }
}
function three1() {
   changeImage3('Call three');
   {
   var img = document.getElementById("image");
   img.src="images/eat.gif";
   document.getElementById("action").innerHTML = "You are currently eating";
   }
}

function call1(){
  callCount1++;
  var btn = document.getElementById('eat');
   if(callCount1 == 1) one();
   else if(callCount1 == 2) two();
  else if(callCount1 == 3) three();
  else btn.disabled = true;

  //callOne = false /*!callOne;*/
}

它执行与第一个按钮相同的功能,而不是按我的要求执行。我已经尝试更改 ChangeImage 函数的编号,但它没有任何作用我该如何解决这个问题?

函数 call1() 调用 one() two()three() 而不是 one1() two1()three1()。这可能是问题所在。