<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
<script src="script.js"></script>
</head>
<body>
<p id="results"></p>
</body>
</html>
var
genId = 2,
curStatus = 'off',
totalCurrentPower = 62,
powerProduced = 62
results = document.getElementById('results');
function changePowerTotal(totalCurrentPower, generatorId, currentStatus, powerProduced) {
if (currentStatus === 'off') {
var offPowerTotal = totalCurrentPower - powerProduced;
alert('Generator # ' + generatorId + ' is now ' + currentStatus + ' , removing ' + powerProduced + 'mw, for a total of ' + offPowerTotal);
return offPowerTotal;
}
else {
var onPowerTotal = totalCurrentPower - powerProduced;
alert('Generator # ' + generatorId + ' is now ' + currentStatus + ' , removing ' + powerProduced + 'mw, for a total of ' + onPowerTotal);
return onPower
}
}
changePowerTotal(totalCurrentPower, genId, curStatus, powerProduced);
/* Styles go here */