如何让点击 1 个按钮改变多个东西的 .innerhtml?

How to make the click of 1 button change the .innerhtml of multiple things?

我是 javascript 和编程的新手,我正在尝试为我的锻炼制作一个程序。我希望能够输入我举起的组数、次数和重量,然后让程序输出整数,这些整数对我的下一次锻炼来说更具挑战性。在底部,我试图让输入按钮更改两个不同元素的 .innerHTML。这可能吗?

`

var userMovement1 = document.getElementById("movement-1").value;
var userSet1 = document.getElementById("set-user-1").value;
var userReps1 = document.getElementById("reps-user-1").value;
var userWeight1 = document.getElementById("weight-user-1").value;
var enterButton = document.getElementById("enter-button");

//Function will calculate the reps for the next workout

function calculateFutureReps(performedReps) {

var futureReps = performedReps;

if (performedReps < 12) {

    return futureReps += 2; 

} else if (performedReps >= 12) {

    return futureReps = 6;
}
 }

 //Function will calculate the weight for the next workout

function calculateFutureWeight(performedWeight) {

var futureWeight = performedWeight
if (performedWeight < 12) {

    return futureWeight; 

} else if (performedWeight >= 12) {

    return futureWeight += 10;
}
 }

 //Getting the value of the functions and storing them in a variable

var newReps = calculateFutureReps(userReps1).value;
var newWeight = calculateFutureReps(userWeight1).value;

//Making that variable show up on the DOM

enterButton.onclick() = document.getElementById("reps-next-1").innerHTML = newReps;
enterButton.onclick() = document.getElementById("weight-next-1").innerHTML = newWeight;`

你可以做这样的事情来处理点击,这是一个可以做任何你想做的事情。

enterButton.addEventHandler('click', function() {
  document.getElementById("reps-next-1").innerHTML = newReps;
  document.getElementById("weight-next-1").innerHTML = newWeight;
});
`