jak ma wyglądać skrypt który pokazuje ile jeszcze znaków można wpisać w odpowiedni formularz

z góry dzieki za pomoc
pozdrawiam
<html> <head> <!-- This file retrieved from the JS-Examples archives 1000s of free ready to use scripts, tutorials, forums. Author: Saqib - http://usgems.net/HALF --> <script> function alll() { var m = document.f1.t1.value; var mm = m.length; document.f1.t2.value = mm; if(mm >= 10) { alert("Max is 10"); document.f1.t1.value = ""; } setTimeout("alll()" ,0); } </script> </head> <body> <form name="f1"> <input type="Textbox" name="t2"> </form> </body> </html>
<script type="text/javascript"> var ns6=document.getElementById&&!document.all function restrictinput(maxlength,e,placeholder){ if (window.event&&event.srcElement.value.length>=maxlength) return false else if (e.target&&e.target==eval(placeholder)&&e.target.value.length>=maxlength){ var pressedkey=/[a-zA-Z0-9\.\,\/]/ //detect alphanumeric keys if (pressedkey.test(String.fromCharCode(e.which))) e.stopPropagation() } } function countlimit(maxlength,e,placeholder){ var theform=eval(placeholder) var lengthleft=maxlength-theform.value.length var placeholderobj=document.all? document.all[placeholder] : document.getElementById(placeholder) if (window.event||e.target&&e.target==eval(placeholder)){ if (lengthleft<0) theform.value=theform.value.substring(0,maxlength) placeholderobj.innerHTML=lengthleft } } function displaylimit(thename, theid, thelimit){ var theform=theid!=""? document.getElementById(theid) : thename var limit_text='<font color="red" size="2"><b><span id="'+theform.toString()+'">'+thelimit+'</span></b></font> znaków do wprowadzenia.' if (document.all||ns6) document.write(limit_text) if (document.all){ eval(theform).onkeypress=function(){ return restrictinput(thelimit,event,theform)} eval(theform).onkeyup=function(){ countlimit(thelimit,event,theform)} } else if (ns6){ document.body.addEventListener('keypress', function(event) { restrictinput(thelimit,event,theform) }, true); document.body.addEventListener('keyup', function(event) { countlimit(thelimit,event,theform) }, true); } } </script>
<script type="text/javascript"> var ns6=document.getElementById&&!document.all function restrictinput(maxlength,e,placeholder){ if (window.event&&event.srcElement.value.length>=maxlength) return false else if (e.target&&e.target==eval(placeholder)&&e.target.value.length>=maxlength){ var pressedkey=/[a-zA-Z0-9\.\,\/]/ //detect alphanumeric keys if (pressedkey.test(String.fromCharCode(e.which))) e.stopPropagation() } } function countlimit(maxlength,e,placeholder){ var theform=eval(placeholder) var lengthleft=maxlength-theform.value.length var placeholderobj=document.all? document.all[placeholder] : document.getElementById(placeholder) if (window.event||e.target&&e.target==eval(placeholder)){ if (lengthleft<0) theform.value=theform.value.substring(0,maxlength) placeholderobj.innerHTML=lengthleft } } function displaylimit(thename, theid, thelimit){ var theform=theid!=""? document.getElementById(theid) : thename var limit_text='<font color="red" size="2"><b><span id="'+theform.toString()+'">'+thelimit+'</span></b></font> znaków do wprowadzenia.' if (document.all||ns6) document.write(limit_text) if (document.all){ eval(theform).onkeypress=function(){ return restrictinput(thelimit,event,theform)} eval(theform).onkeyup=function(){ countlimit(thelimit,event,theform)} } else if (ns6){ document.body.addEventListener('keypress', function(event) { restrictinput(thelimit,event,theform) }, true); document.body.addEventListener('keyup', function(event) { countlimit(thelimit,event,theform) }, true); } } </script> <form action="dodaj.php" method="post" name="sampleform"> <input type="text" name="tytul" maxlength="60"> <script> displaylimit("document.sampleform.tytul","",60) </script> <script> displaylimit("","wstep",200) </script> <input type="submit" name="submit" value="Wy¶lij" class="ramka" style="margin-top:5px;"> </form>
<br />
<div class="full clearfix border_t box"> <p> <label for="comment"><?php echo SPEC($GLOBALS['_LANG']['_tpl_add14']) ?><span class="required">*</span></label><br /> </p> </div>