Показать сообщение отдельно
  #2 (permalink)  
Старый 30.01.2017, 09:50
Аватар для рони
Профессор
Отправить личное сообщение для рони Посмотреть профиль Найти все сообщения от рони
 
Регистрация: 27.05.2010
Сообщений: 33,068

javascript_pupil,
<!doctype html>
<html>
<head>
  <meta charset="utf-8">
<script>
window.addEventListener('DOMContentLoaded', function() {
  [].forEach.call(document.querySelectorAll('form'), function(form) {
          form.addEventListener('input', function() {
              form.fieldtext.value = form.text.value.length;
          });
      });
    });
</script>
<title>Счетчик</title>
</head><body>

<div class="wrap">

<form action="script.cgi" method="post" name="new_record" id="web">
<fieldset><label for="text">Текст
<br><span class="ta_count">знаков <input type="text" name="fieldtext" disabled></span></label>
<textarea id="text" name="text" placeholder="" required></textarea>
</fieldset>
<script>countChars('new_record');</script>
<input type="submit" value="Добавить запись"> <input type="reset" value="Сброс">
</form>

<form action="script.cgi" method="post" name="new_record" id="web">
<fieldset><label for="text">Текст
<br><span class="ta_count">знаков <input type="text" name="fieldtext" disabled></span></label>
<textarea id="text" name="text" placeholder="" required></textarea>
</fieldset>
<script>countChars('new_record');</script>
<input type="submit" value="Добавить запись"> <input type="reset" value="Сброс">
</form>

</div>
</body></html>
Ответить с цитированием