How to set global variable between two html number inputs
Hello, my first post...
I am trying to use two different html number input boxes to set a global variable that runs an endless looping number counter. The first input works fine but the second one loses focus after it's clicked? (I'm new at this really)
What I want is to be able to change the variable by clicking either of the number inputs. If I want one of the numbers running, I just click it or change the value. If I want the other value, just click it to change, or change the value.
It seems impossible to get the variable to change.
I don't have to do anything to the first input because it it actve, just change the value and restart the counter.
I have tried everything under the sun and cannot get the second input to set the variable.
Thanks for any suggestions. I am very new at this.
- <script>
- function changeval() {
start_counter();
}
function updateInput() {
start_counter();
}
- </script>
- <html>
- <input type="number" onmouseup="updateInput()" NAME="target" size="2" class="btn2" min="" id="input2" style="font-family:roman; width: 55px;" value="20" >
- <input type="number" class="btn2" id="speed" NAME="target" size="2" min="0" style="font-family:roman; width: 55px;" value="25" onclick="function changeval() ">
- </html>