What do you mean by this, in more details?
If you're talking about a js popup, then I don't think it's possible. However modal dialogs like jQueryUI popups, which may serve a similar purpose for you can be controlled as you can use a
<input maxlength="20" ... />
BTW - if you want further info, post to the js forum, not php.
now how to set char limit in prompt box?
This cannot be done with the prompt() function, you shoul look towards the jQueryUI or something like that.