Oto kod JavaScript :
var maxAmount = 250; function textCounter(textField, showCountField){ alert('abc'); var numOfChars = textField.innerHTML.length; if(numOfChars > maxAmount){ textField.innerHTML = textField.innerHTML.substring(0,maxAmount); } else{ showCountField.value = maxAmount - numOfChars; } }
A oto kod HTML :
<form> <!--Hide (but keep) your normal textarea and place in the iFrame replacement for it --> <iframe name='richTextField' id='richTextField' onkeydown='alert("abc");' onclick='alert("abc");' <!-- onkeydown='textCounter(this.form.richTextField,this.form.countDisplay);' onkeyup='textCounter(this.form.richTextField,this.form.countDisplay);' --> ></iframe> <input readonly type='text' name='countDisplay' size='3' maxlength='3' value='250'>Character remaining <!-- End replacing your textarea --> </form>
Przed iframe jest textarea ponieważ przed przesłanie danych kopiuje to co jest wpisane w iframe i wpisuje to w textarea żeby to przesłać do skryptu PHP a później do bazy danych. Niestety nawet funkcję diagnostyczne alert('abc') nie działają.
Jak by ktoś pomógł to by było fajnie
