I don't know what programming language you are using, but if it was something like ASP.NET, I would suggest in code behind to get the length of the string, and then set the password as asterisks before you send it to the client side page.
Do this in the relevant place of your client side page:
string displayPassword = string.Empty;
for(int i = 0; i < thePassword.Length; i++)
displayPassword += "*";
Then expose the "displayPassword" variable on your page instead of the actual password.
I think there may be something with what you are trying to do though, really you shouldn't be able to decrypt the passwords (1 way encryption is best), and also showing the user the number of characters in the password whilst hiding the password seems a little conflicting.