hola JavierB y JuanKa!
Estу codigo hace lo que pides. Chequealo, y nos dices.
Código HTML:
<html>
<head>
<title>Untitled Document</title>
<script>
function validarNum(e)
{
tecla = (document.all) ? e.keyCode : e.which;
if (tecla == 8) return true;
patron = /[0-9\,\.]/;
te = String.fromCharCode(tecla);
return patron.test(te);
}
</script>
</head>
<body>
<input name="txt_importe" type="text" id="txt_importe" size="10" onKeypress="return validarNum(event)" >
</body>
</html>