<a href="#">-</a><input value="1" type="text" /><a href="#">+</a>
------解决方案--------------------
- HTML code
<a href="javascript:op(-1)">-</a><input value="1" type="text" id="txt" /><a href="javascript:op(1)">+</a> <script type="text/javascript"> function op(unit) { var txt = document.getElementById('txt'), v = txt.value; txt.value = parseInt(v, 10) + unit; } </script>
------解决方案--------------------
- JScript code
<script src="http://code.jquery.com/jquery-latest.js"></script> <script type="text/javascript"> function op(unit) { $("#txt").val(parseInt($("#txt").val())+unit); } </script>