OK, I have this script in an ASP (classic) page
which works great. It sums each form field as you go. I also pass in a value in the querystring, called num. Now, I want to warn people that they can't enter a total greater than the number that I have passed in via querystring, so I want to pop up an alert if their total is greater than num, but I am not sure how to do that, so... Any ideas or suggestions how to do this?
Thanks,
Willie
Code:
<script language="JavaScript" type="text/javascript">
function calculate(el)
{
var form = el.form;
var xsmall = Number(form.elements["xsmall"].value );
var small = Number(form.elements["small"].value );
var medium = Number(form.elements["medium"].value );
var large = Number(form.elements["large"].value );
var xlarge = Number(form.elements["xlarge"].value );
var xxlarge = Number(form.elements["xxlarge"].value );
var total = xsmall + small + medium + large + xlarge +xxlarge;
// Check for user entry errors
if (isNaN(total)) {
// Alert user of error
alert("Please enter only numbers");
} else {
// Show total in the form field, and select the form field text
form.elements["total"].value = total;
//form.elements["total"].select();
}
}
</script>
which works great. It sums each form field as you go. I also pass in a value in the querystring, called num. Now, I want to warn people that they can't enter a total greater than the number that I have passed in via querystring, so I want to pop up an alert if their total is greater than num, but I am not sure how to do that, so... Any ideas or suggestions how to do this?
Thanks,
Willie