Hello!
I have a form for calculating the area in width and length. And the Javascript function to calculate.
<div class='controls'> <input type="text" id='dlin' onkeyup='Rech()' value="1" style="width: 30px;"/> х <input type="text" id='shir' onkeyup='Rech()' value="1" style="width: 30px;"/> м <span style="margin-left:50px;">Площадь потолка:<span id='ploshad'>0</span> м<sup>2</sup></span> </div> <script language="JavaScript"> function Rech() { var ploshad = document.getElementById('ploshad'), dlin = parseFloat(document.getElementById('dlin').value), shir = parseFloat(document.getElementById('shir').value); ploshad.innerHTML = (dlin * shir).toFixed(2);</script>
Calculations happen without problems, only when entering data on the NUM PAD keyboard in the form of decimal numbers in the Russian layout - instead of a period a comma is inserted and this prevents correct calculation.
Friends, Please tell me the code that will replace the comma with a period and where to embed it, knowledge of Javascript is not enough, please explain in more detail!
Thanks in advance.