<html> <head> <script type="text/javascript"> function SetPrice(a) { var e = document.getElementById('price'); e.innerHTML = +e.innerHTML + a * +document.getElementById('x').value; }; </script> </head> <body> <span id="price"> 100 </span> $ <input type="text" id="x" value="10" /> <input type="button" value="+" onclick="SetPrice(1);" /> <input type="button" value="-" onclick="SetPrice(-1);" /> </body> </html>