After searching the web for answers but not getting anywhere. Can anyone please tell me how to format either my variable or my textbox preferably into currency or if simpler then into a 2 place decimal value. My code initially takes variables received from previous pages and one which is user inputted, removes the comma's from the received variables, adds the 2 together but I cannot get them to display as currency or a formatted value.
Ive seen, and tried a variety of solutions within this forum but as I know very little about JS and I probably havent understood the code Ive seen e.g. Fixed.to(2), currency etc.
The item Im trying to format is the last line 'txtCortsTotal'
Ive seen, and tried a variety of solutions within this forum but as I know very little about JS and I probably havent understood the code Ive seen e.g. Fixed.to(2), currency etc.
The item Im trying to format is the last line 'txtCortsTotal'
Code:
function calcTotal() {
var f = document.forms['form1'];
f.elements['txtBroker'].value = (f.elements['txtBroker'].value).replace(/,/g, ''); //removes commas
var BrokerComm = parseFloat(f.elements['txtBroker'].value);
f.elements['CortsPriceWithOptionsHidden'].value = (f.elements['CortsPriceWithOptionsHidden'].value).replace(/,/g, ''); //removes commas
var CortsTotalWithOptions = parseFloat(f.elements['CortsPriceWithOptionsHidden'].value);
f.elements['[b]txtCortsTotal[/b]'].value = BrokerComm + CortsTotalWithOptions;
}