Форма ответа

Код:
<input id="num" type="text" class="codeButtons" readonly="true" style="width:40px;text-align:center" title="Счётчик символов">
<script type="text/javascript">
document.getElementById("main-reply").addEventListener('focus', nc, false);
document.getElementById("main-reply").addEventListener('keydown', nc, false);
document.getElementById("main-reply").addEventListener('keyup', nc, false);
document.getElementById("main-reply").addEventListener('keypress', nc, false);
document.getElementById("main-reply").addEventListener('change', nc, false);
function nc(){document.getElementById('num').value = document.getElementById('main-reply').value.length}    
</script>