Please check this code :

```
function CalCPM()
{
    var nv = document.getElementById('txtviews').value;
    var nc = document.getElementById('txtcost').value;
    var result =parseFloat(nc) / parseFloat(nv)/1000;
    if(!isNaN(result))
    {
        document.getElementById('cpm').value = result.toFixed(4); 
    }
}

```

it work fine expect when you put comma in the number, means if you put in txtviews 1000000 and in txtcost 3000 you get a correct result that is 3.000

However if you use commas in any of the numbers then the problem starts, like

if you put in txtviews 1,000,000 and in txtcost 3,000

then the result will be 0.000003

OR if you start by putting value for txtcost first
then the result will be 3000.0000

which is not a correct value either way, any idea what is the problem??