Digit only TextField with a unique decimal point in Javascript
<p>I could develop the following code in Javascript that allows only digits to a given HTML <code>TextField</code>.</p>

<pre><code>function isNumberKey(evt)
{
    var charCode = (evt.which) ? evt.which : event.keyCode;
    if (charCode &gt; 31 &amp;&amp; (charCode &lt; 48 || charCode &gt; 57))
    {
        return false;
    }
    return true;
}

&lt;input type='text' id='textField' name='textField' onkeypress="return isNumberKey(event);"&gt;
</code></pre>

<p>but I need to allow <em>one and only one</em> decimal point (<strong>.</strong>) to be entered to the <code>TextField</code>. I tried some way but I didn't fabricate the code that could suite this requirement. How can I allow only digits along with a <strong>unique</strong> decimal point to a given <code>TextField</code>?</p>
