Coupon Validate

[Total: 0    Average: 0/5]

Coupon validation code segment adjusts order total.

Head Code:

<script language = "JavaScript">
function couponVerify()
{
var orderTotal = 20.95;
var couponValue = window.document.xyzFORM.COUPON.value;
window.document.xyzFORM.COUPON.value = "";
    if((couponValue < 1000 ) && (couponValue > 900))
    {
    var newTotal = orderTotal - 5;
        if(newTotal < 5)newTotal = 0;
    window.document.xyzFORM.COUPON.value = "$   5.00";
    window.document.xyzFORM.TOTAL_DUE.value = "$  " + newTotal;
    }
    if((couponValue < 901) && (couponValue > 999))
    {
    window.document.WEB_ORDER_FORM.COUPON.value = "  -";
    }
}
</script>

Body Code:

<center>
<form name = "xyzFORM">
Enter coupon number:
<input type = "text" name = "COUPON" size = "10" onChange = "couponVerify()">
<br>
&nbsp &nbsp &nbsp  Total amount due:
<input type = "text" name = "TOTAL_DUE" value = "$   20.95" size = "10">
</form>
<font size = "0">(Note: coupon validation number range for this demo is 901 - 1000.)
</center>

Times Viewed: 0

Leave a Reply

Your email address will not be published. Required fields are marked *