Forum Moderators: open
I'm new to JavaScript, and I need some help with this :)
I have an input box:
<input name="inputbox" type="text" value="123" />
What I'm trying to do, is have a "+ 1" a href link, that when pressed, would add +1 to the existing value. So for example if I pressed the +1, the value would increase to 124, if I pressed it again it would increase to 125.
Thanks :)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title> Test </title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
</head>
<body><form name="myForm" action="" method="">
<input name="inputbox" type="text" value="123">
</form><a href="#" onclick="addOne()">+1</a>
<script type="text/javascript">
addOne = function(){ document.myForm.inputbox.value = document.myForm.inputbox.value*1 + 1 ; }
</script></body>
</html>