Hi guys. I am writing quite a basic form to which shall calculate a refund in accordance with a refund matrix.
The "user" enters the Daily Cost and then the Day's Offline and hits the calculate button. The total amount due to be refunded is then placed within a readonly textbox.
I have done all the above so well so good![]()
I am finding it extremely difficult to do the next step that I would like some help on. I would like a message, in accordance with the total refund if greater than 0 then message = "example of a message" and if greater than 20 then message = "another example of a message" --> this message should appear in another textbox.
FORM
SCRIPT SO FARCode:<div align="right"> <form name="refund"> Daily Cost: <input type="text" id="dailycost" name="dailycost" size="10" value="0."> Day's Offline: <input type="text" id="downtime" name="downtime" size="10" onkeypress="return isNumberKey(event)" maxlength="3"> <input type="button" id="calc" name="calc" value="Calculate" onClick="calcRefund()"> Refund Due: <b>£</b><input type="text" id="adjustment" name="adjustment" size="10" style="font-weight:bold;" readonly><br /> <input type="text" id="info" name="info" size="60" readonly><input type="reset" id="reset" name="reset" value="Reset"> </form></div><p />
Any help with this would be fantastic! ThanksCode:<!-- Begin function calcRefund() { var dailycost = eval(document.refund.elements[0].value) var downtime = eval(document.refund.elements[1].value) var adjustmentrefund = dailycost * downtime document.refund.adjustment.value=adjustmentrefund; } // End --> function isNumberKey(evt) { var charCode = (evt.which) ? evt.which : event.keyCode if (charCode > 31 && (charCode < 48 || charCode > 57)) return false; return true; }



Reply With Quote


Bookmarks