Hey guys.
I have a problem with my code, I can replace comma for a dot here. "var tvn = parseFloat(docu ment.getElement ById('ctl00_Con tentPlaceHolder 1_txtMillilTVNH raefni').value. replace(/,/g, '.')*14);" and multiply with 14, that works fine, but i can't replace a dot for a comma before I display the sum. In me country we use comma instead of a dot for separating decimal numbers
For example: a user has to be able to import 1,25 in a text box on my web site which changes to 1.25 before it's multiplied with 14 to get the sum of 17.5. But I have to change it to 17,5 before displaying. (which isn't working somehow)
Here is my code:
It would be nice if somebody could help me.
I have a problem with my code, I can replace comma for a dot here. "var tvn = parseFloat(docu ment.getElement ById('ctl00_Con tentPlaceHolder 1_txtMillilTVNH raefni').value. replace(/,/g, '.')*14);" and multiply with 14, that works fine, but i can't replace a dot for a comma before I display the sum. In me country we use comma instead of a dot for separating decimal numbers
For example: a user has to be able to import 1,25 in a text box on my web site which changes to 1.25 before it's multiplied with 14 to get the sum of 17.5. But I have to change it to 17,5 before displaying. (which isn't working somehow)
Here is my code:
Code:
function calculateTVN()
{
if (document.getElementById ('ctl00_ContentPlaceHolder1_txtMillilTVNHraefni').value != "")
{
var tvn = parseFloat(document.getElementById('ctl00_ContentPlaceHolder1_txtMillilTVNHraefni').value.replace(/,/g, '.')*14);
var tvns = tvn.replace (/\./g, ',');
document.getElementById('ctl00_ContentPlaceHolder1_txtNidurstTVNHraefni').value = tvns.toFixed(2);
}
}
Comment