function numeros_enteros(e){
var key = window.event ? e.keyCode : e.which;
if ( (key == 8) || (key ==0)){
return true;
}
var keychar = String.fromCharCode(key);
reg = /\d/;
return reg.test(keychar);
}
function numeros_decimales(e,texto){
var key = window.event ? e.keyCode : e.which;
if ( (key == 8) || (key ==0)){
return true;
}
hay_punto=texto.indexOf('.');
if (hay_punto < 0 ){
if (key == 46){
return true;
}
}
var keychar = String.fromCharCode(key);
reg = /\d/;
return reg.test(keychar);
}
//y en el form le pones asi
<input type="text" name="txtTelefono" id="txtTelefono" onkeypress="return numeros_enteros(event);" onblur="if((this.value.match(/^\d+$/))==null){this.value = \'\';}" />
<input type="text" name="txtPrecio" id="txtPrecio" onkeypress="return numeros_decimales(event,this.value)" onblur="if((this.value.match(/^\d+$/))==null){this.value = \'\';}" />
![sonriente](http://static.forosdelweb.com/fdwtheme/images/smilies/smile.png)
![sonriente](http://static.forosdelweb.com/fdwtheme/images/smilies/smile.png)
![sonriente](http://static.forosdelweb.com/fdwtheme/images/smilies/smile.png)
![sonriente](http://static.forosdelweb.com/fdwtheme/images/smilies/smile.png)
![sonriente](http://static.forosdelweb.com/fdwtheme/images/smilies/smile.png)
![sonriente](http://static.forosdelweb.com/fdwtheme/images/smilies/smile.png)
![sonriente](http://static.forosdelweb.com/fdwtheme/images/smilies/smile.png)