ialex
New Member
Posts: 10
inherit
143112
0
May 29, 2010 13:09:41 GMT -8
ialex
10
July 2009
ialex
|
Post by ialex on Jun 22, 2007 2:38:22 GMT -8
This code will allow you to reduce the allowed limit of characters when posting. Simply edit the red text with the new maximum amount of characters, and the error message to appear when this limit is exceeded.
Cross Browser.
Global Footer.
<script type="text/javascript"> <!--
/*Maximum message length - By iAlex - Open Source*/
var iMaximumCharacters='10000'; //Maximum Message Length. var iMaximumError="We apologies, but your message has exceeded the maximum allowed characters."; //Error message.
if(document.postForm && document.postForm.counter){ var iCounter=document.postForm.counter; iCounter.value=iMaximumCharacters; var iMessage=document.postForm.message; function iCheck(){ iCounter.value=(iMaximumCharacters-iMessage.value.length); if(iMessage.value.length>iMaximumCharacters){ iMessage.value=iMessage.value.slice(0, iMaximumCharacters); iCounter.value=0; alert(iMaximumError); } } iCheck(); iMessage.onkeypress=function(){iCheck();}; iMessage.onmouseup=function(){iCheck();}; iMessage.onmousedown=function(){iCheck();}; iMessage.onkeyup=function(){iCheck();}; iMessage.onkeydown=function(){iCheck();}; }
//--> </script>
|
|