De la siguiente manera funciona:
Código PHP:
function contador(maxim)
{
this.maximo = maxim;
this.div;
this.campo;
this.contar = function()
{
this.div.innerHTML = maxim-this.campo.value.length;
if (this.campo.value.length==this.maximo)
{
return false;
}
else
{
return true;
}
}
}
ahora la inicialiazacion del objeto:
Código PHP:
function pruebaCargar(){
lugar = new contador(20);
lugar.campo = document.getElementById('lugar');
lugar.div = document.getElementById('lugardiv');
}
ahora cargamos esta ultima funcion:
Código HTML:
<body onload="pruebaCargar()">
El resto de HTML lo dejas como lo tenias y te deberia de funcionar.
Saludos.