Forum Moderators: open

Message Too Old, No Replies

increment <input type="text"> value

i'm trying to increment the value in a <input type="text"> box.

         

decbrad

11:24 pm on May 25, 2007 (gmt 0)

10+ Year Member



Hi all... just a quick question! I have a standard form field that gets filled from a database when the page loads... all good so far! What I would like to do is allow the users to increment this value by adding a plus and minus each side. I'm guessing this can be done with JavaScrips, but I don't know where to begin!

If anybody can point me in the right diection, or even to an online tutorial, i'd seriously appreciate it!

Thanks in advance

Decbrad

Fotiman

2:54 pm on May 29, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You will probably get more responses in the JavaScript forum [webmasterworld.com].

codename065

9:16 pm on May 29, 2007 (gmt 0)

10+ Year Member



Hi!
Try with it.


<input type=button value='-' onclick='javascript:process(-1)'>
<input type=test size=10 id='v' name='v' value='0'>
<input type=button value='+' onclick='javascript:process(1)'>


<script language=javascript>
function process(v){
document.getElementById('v').value+=v;
}
</script>