Hola de nuevo.
 
Hagamos algunos cambios en el código: 
 Código PHP:
    <html>
<head>
<script>
function pulsar(obj) {
  txt=obj.value;
  if (txt.length>16) {
    obj.value=txt.substr(0,16);
    alert('Algo');
    return false;
  }
}
</script>
</head>
<body>
<input type="text" onkeyup="return pulsar(this)" onblur="pulsar(this)" />
</body>
</html> 
   
  Saludos, 
