Jump to content
MakeWebGames

Recommended Posts

Posted

I currently have a mailbo chars limit to stop the abusers out there. Is there a way to make the chars cout down when typing so people are aware when there getting to the limit. Many thx in advance for any help.

Posted

Re: Mail Box

 

<script language="javascript">
var max = 50;
function count(obj) {
 cur_new = max - document.getElementById(obj).value.length;
 document.getElementById('counter').innerHTML = cur_new;
 return true;
}
</script>

 

Just add the textbox and span/div element.

<textarea onkeypress="javascript:count(this.id)" id="co_txt"></textarea>
<span id="counter">50</span>

 

http://www.quirksmode.org/dom/maxlength.html

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...