var postageOptions = []; $('#shipTo').change(function() { var totalLessShip = ; var s = document.getElementById('shipTo'); var des = s.options[s.selectedIndex].value; var freeJSpostagePrice = ; if(freeJSpostagePrice){ document.getElementById('payPost').value = '0'; }else{ var shippingPrice = postageOptions[des].cost; document.getElementById('payPost').value = ''+shippingPrice; document.getElementById('shipCost').innerHTML = ''+shippingPrice.toFixed(2); var gTotalTrailing = ''+(shippingPrice+totalLessShip).toFixed(2); document.getElementById('grandTotal').innerHTML = gTotalTrailing; } document.getElementById('cardShip').value = des; });