CowboyFanTech
Programmer
I'm having a problem with retrieving a value from a text box and modifying it while being to display it in a window.alert box. I can multiply the value; but, if i want to add anything else it (javascript) will only concatenate the result. Here is my code for the function:
<script type="text/javascript">
/* <![CDATA[*/
function ShippingCharge(form, form01) {
var shipping001 = document.getElementById('shipp001').value;
var ShippingsubTot = document.getElementById('shipp001').value;
var ShippingMinimum = 250.00;
var ShippingRate = .10;
var AdditionalShipping = .15;
var ShippingTotal = 0;
var ShippingTotal001 = 0;
var Display01 = "Shipping Charge will be: $";
var Display02 = "Total Charge including shipping will be: $";
if (shipping001 >= ShippingMinimum) {
ShippingTotal001 = (parseInt(shipping001.value) * AdditionalShipping) + parseInt(ShippingsubTot.value);
return window.alert("" + Display02 + "" + ShippingTotal001 + "");
}
else {
ShippingTotal = shipping001 * ShippingRate;
ShippingTotal += shipping001;
return window.confirm("Shipping charge will be: $" + ShippingTotal + " ");
}
}
This has to be a simple fix.
Thanx,
CowboyfanTech
<script type="text/javascript">
/* <![CDATA[*/
function ShippingCharge(form, form01) {
var shipping001 = document.getElementById('shipp001').value;
var ShippingsubTot = document.getElementById('shipp001').value;
var ShippingMinimum = 250.00;
var ShippingRate = .10;
var AdditionalShipping = .15;
var ShippingTotal = 0;
var ShippingTotal001 = 0;
var Display01 = "Shipping Charge will be: $";
var Display02 = "Total Charge including shipping will be: $";
if (shipping001 >= ShippingMinimum) {
ShippingTotal001 = (parseInt(shipping001.value) * AdditionalShipping) + parseInt(ShippingsubTot.value);
return window.alert("" + Display02 + "" + ShippingTotal001 + "");
}
else {
ShippingTotal = shipping001 * ShippingRate;
ShippingTotal += shipping001;
return window.confirm("Shipping charge will be: $" + ShippingTotal + " ");
}
}
This has to be a simple fix.
Thanx,
CowboyfanTech