<Script language = "JavaScript">
<! --
VaR isie = false;
VaR isff = false;
VaR Issa = false;
If (navigator. useragent. indexof ("MSIE")> 0) & (parseint (navigator. appversion)> = 4) isie = true;
If (navigator. useragent. indexof ("Firefox")> 0) isff = true;
If (navigator. useragent. indexof ("safari")> 0) Issa = true;
Function onlynumber (E)
{
Var key;
Ikeycode = Window. event? E. keycode: E. Which;
If (! (Ikeycode> = 48) & (ikeycode <= 57) | (ikeycode = 13) | (ikeycode = 46) | (ikeycode = 45) | (ikeycode = 37) | (ikeycode = 39) | (ikeycode = 8 )))
{
If (isie)
{
E. returnvalue = false;
}
Else
{
E. preventdefault ();
}
}
}
// -->
</SCRIPT>
<Input type = "text" onkeypress = "Return onlynumber (event)">
Another one:
==================================
<Input type = "text" onkeyup = "this. value = This. value. replace (/[^ /. /d]/g, ''); If (this. value. split ('. '). length> 2) {This. value = This. value. split ('. ') [0] + '. '+ this. value. split ('. ') [1]} ">