I'm making my first website and have come to a block in the road so to speak. I have a few pages of html and css and now I need this counter that will loop between 1 and x, I will have to input x via the keyboard (user side). I would rather not use a prompt window but rather an input type textbox for the variable. When I click the stop button, I want this to write the number that the counter was stopped on and then start again and keep doing this same cycle over for ten times. I have spent three days trying to figure this javascript out and am getting a headache. Can someone point me in the right direction? Is there a better way of doing this or am I on the right track?
Here's what I have so far...

[code]
<html>
<head>
<script type="text/javascript">
var c=0;
var t;
var timer_is_on=0;

function timedCount()
{
document.getElementById('txt').value=c;
c=c+1;
t=setTimeout("timedCount()",10);
}

function doTimer()
{
if (!timer_is_on)
{
timer_is_on=1;
timedCount();
}
}

function stopCount()
{
clearTimeout(t);
timer_is_on=0;
}
</script>
</head>

<body>
<form>
<input type="button" value="Start count!" onclick="doTimer()"><br/>
<input type="text" size="10" id="txt"><br/>
<input type="button" value="Stop count!" onclick="stopCount()"><br/>
</form>
</body>
</html>
[code]
I hope this is posted correctly!!! Thanks for any suggestions.