Skip to content
Advertisement

Changing a variable value/re referencing it with SetIncrement

I have a timer I use to count how many masks are made in a production environment. I use a variable value that is user input when the page is started – it is called SAMS, basically how many masks 1 person can make in an hour would be what I would input depending on how many people I have working. IE. 2 people may be 18, 1 may be 9 etc. The problem I have with my current build is that I cannot change the SAMS value if I have someone leave for the day. So then what I use that value to calculate is off (I use it to show a GOAL value that increments based on the value).

Here is the relevant code for the processes I’ve described.

JavaScript

I also have START/STOP/RESET buttons on the page for the timer itself. I tried putting the SAMSINPUT input into the stop button, because if I could stop it, put in a new SAMSINPUT – and have the increment adjusted to the new value, that would solve this for me. However, that doesn’t seem to change the actual value that SetInterval references, if I start with a 5, then change it to a 10 that way, it still increments at 5.

Advertisement

Answer

Would this work? Let me know if you have any problems/issues.

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement