<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script language="javascript1.2">
function somenteNumeros(valor, id, evento)
{
	//inicializa a variavel que vai conter o valor final
    var valorFinal = "";
	
	//verifica o que foi digitada para que seja verificado se � somente n�meros ou n�o 
	var tecla = evento.keyCode; 
	
	if(((tecla > 95) && (tecla < 106)) || ((tecla > 47) && (tecla < 58)))
	{
		//0 = 96 ou 48
		//1 = 97 ou 49
		//2 = 98 ou 50
		//3 = 99 ou 51
		//4 = 100 ou 52
		//5 = 101 ou 53
		//6 = 102 ou 54
		//7 = 103 ou 55
		//8 = 104 ou 56
		//9 = 105 ou 57
		valorFinal = valor;
	}
	else
	{
		valorFinal = valor.substring(0, valor.length -1); 
	}
	
	document.getElementById(id).value = valorFinal; 
}

function somenteLetras(valor, id, evento)
{
	//inicializa a variavel que vai conter o valor final
    var valorFinal = "";
	
	//verifica o que foi digitada para que seja verificado se � somente n�meros ou n�o 
	var tecla = evento.keyCode; 
	
	if(((tecla < 95) || (tecla > 106)) && ((tecla < 47) || (tecla > 58)))
	{
		//0 = 96 ou 48
		//1 = 97 ou 49
		//2 = 98 ou 50
		//3 = 99 ou 51
		//4 = 100 ou 52
		//5 = 101 ou 53
		//6 = 102 ou 54
		//7 = 103 ou 55
		//8 = 104 ou 56
		//9 = 105 ou 57
		valorFinal = valor;
	}
	else
	{
		valorFinal = valor.substring(0, valor.length -1); 
	}
	
	document.getElementById(id).value = valorFinal; 
}
</script>
</head>

<body>
<table width="378" border="0">
  <tr>
    <td width="124">Somente N&uacute;meros: </td>
    <td width="244"><input type="text" name="numeros" id="numeros" onkeyup="somenteNumeros(this.value, this.id, event)" /></td>
  </tr>
  <tr>
    <td>Somente Letras: </td>
    <td><input type="text" name="letras" id="letras" onkeyup="somenteLetras(this.value, this.id, event)" /></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
</body>
</html>