<script LANGUAGE="JavaScript"> <!-- Original: Ronnie T. Moore --> <!-- Web Site: The JavaScript Source --> <!-- Dynamic 'fix' by: Nannette Thacker --> <!-- Web Site: http://www.shiningstar.net --> <!-- This script and many more are available free online at --> <!-- The JavaScript Source!! http://javascript.internet.com --> <!-- Begin function textCounter(field, countfield, maxlimit) { if (field.value.length > maxlimit) // if too long...trim it! field.value = field.value.substring(0, maxlimit); // otherwise, update 'characters left' counter else countfield.value = maxlimit - field.value.length; } // End --> </script>
Wyświetlanie w formularzu może wyglądać np. w taki sposób:
<input type="text" name="shoutbox_tresc" id="domyslny" size="55" MAXLENGTH="500" onKeyDown="logIn( 'zaloguj' ); textCounter(this.form.shoutbox_tresc,this.form.remLen,500)" onKeyUp="textCounter(this.form.shoutbox_tresc,this.form.remLen,500);" id="domyslny"/> <input readonly type=text name="remLen" size=3 maxlength=3 value="500">
Pytanie dotyczące powyższych inputów. Czy istnieje możliwość, by po osiągnięciu wartości 0 w inpucie "remLen" użytkownikowi wyskakiwał komunikat o przekraczaniu limitu znaków? Jeśli tak, to jak to zrobić?
Z góry wielkie dzięki...