0

Hi Folks

I am trying to add a spin control to my quantity field before i add the ordered quantity to a shop cart array.

The way its set up at the moment if you click the deincrement arrow it actually goes into negative numbers. (no good coz people cant order a negative number eh#$@#$@)
This the

<head> Code
<!---sPIN BUTTONS TO UP QUANTITY--->
<script type="text/javascript">
function changeVal(n) {
			document.forms[0].quantity.value =parseInt(document.forms[0].quantity.value) + n;
			}
			
	</script>

AND this is in my formfield:
                        <td ><input name="quantity" type="text" class="quantity" value="1" onFocus="this.blur();" ></td>
                        <td style="width:14px;">
						<table cellpadding="0" cellspacing="0">
             		   <td width="28"><img src="siteImages/btn_up.gif" width="14" height="9" hspace="0" vspace="0" border="0" onClick="changeVal(1);"></td>
            	      </tr>
        	          <tr>
             	     <td><img src="siteImages/btn_down.gif" width="14" height="9" border="0" hspace="0" vspace="0" onClick="changeVal(-1);"></td>
          	         </tr>

How can i set this to a Minimum of 1 in the field please.
I have found this in about 4 hours of googling:- document.forms[0].quantity ({min:1}); and have tried adding this in all sorts of combinations but i still get those negative numbers

Can Anyone PLEASE help this "java DDumb Ar// out please
cheers and thanks in advance
Grabit

Edited by ~s.o.s~: Added code tags, learn to use them.

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by jon.kiparsky
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.