Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.1 kB
1
Indexable
Never
function changeTheValue(id,teamId) {
  
  if(document.getElementById(id).innerText == "X") {
    document.getElementById(id).innerText = ""

    let colorValue = parseInt(document.getElementById(teamId).innerText)
    colorValue = colorValue - 1;
    document.getElementById(teamId).innerText = colorValue
    changeTheColor(teamId);
  } else {
    document.getElementById(id).innerText = "X"

    let colorValue = parseInt(document.getElementById(teamId).innerText)
    colorValue = colorValue + 1;
    document.getElementById(teamId).innerText = colorValue
    changeTheColor(teamId);
  }
 
}

function changeTheColor(id) {
  let totaltValue1 = parseInt(document.getElementById(id).innerText)
  console.log(totaltValue1  + "totaltValue1 = " + totaltValue1)
  if(totaltValue1 == '1'){
    document.getElementById(id).style.backgroundColor = "yellow";
  } else if(totaltValue1 == '0'){
    document.getElementById(id).style.backgroundColor = "red";
  } else {
    document.getElementById(id).style.backgroundColor = "green";
  }
}