hi all
i'm trying to check the dynamic values of an input field and change it if the value is over a certain amount.
This is the script i'm using (this works fine for a single input value, but i need it to work where the input value/s are in a loop).

Code:
<script>
  function handleChange(input) {
    if (input.value < 0) input.value = 0;
    if (input.value > <%= FormatNumber((RSStockLevel.Fields.Item("InStock").Value)-(RSStockLevel.Fields.Item("NumberSold").Value), 0, -2, -2, -2)- objCart.GetCartValue("Quantity",i) %>) input.value = <%= FormatNumber((RSStockLevel.Fields.Item("InStock").Value)-(RSStockLevel.Fields.Item("NumberSold").Value), 0, -2, -2, -2)- objCart.GetCartValue("Quantity",i) %>;
  }
</script>
and for the input values (remember this code is in a loop (repeated depending on the number of records found))

Code:
<input name="<%="Qty" & objCart.GetCartValue("Key",i)%>" type="text" class="cartcontent" value="<%=objCart.GetCartValue("Quantity",i)%>" onchange="handleChange(this);" size="4" maxlength="2" />
Hope someone can advise

Thanks in advance
Andy