Alright, so I am trying to create a countdown timer that will take a number that you put into an HTML input field and then take that, assign it to the variable x, and have it go through an equation that outputs the amount of time to be counted down.
I have the timer completely setup and everything. I have everything setup equation wise: that is, I have it setup to where I can physically set x = some number and it will countdown from the appropriate time.
The problem I am having is that I cannot seem to get it to the point where I have a some user input and that then becomes x, and then it outputs that appropriate time.
Here is my code:
<body>
Number: <input id="num" type="text" name="number">
<button type="button" onClick="buttonClick()">Submit</button>
<div id='timer' />
<script type="text/javascript">
var x;
var y=Math.pow(x, 2);
var z=(y+4*x+10);
window.onload = CreateTimer("timer", z);
</script>
</body>
I have tried dozens of suggestions throughout the site, but none of them really had to do with what I am trying to do, and none of them worked. I have tried many different functions that take the onClick function and use things like
x=getElementbyID("num").value
and have as well as
w=getElementbyID("num");
x=w.value;
I cannot seem to think of how to do it. Any help will be much appreciated. :)