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

javascript_pupil, вызывать скрипт, который ниже в коде, повторно не нужно. достаточно одной таблетки!
<!doctype html>
<html>
<head>
  <meta charset="utf-8">
<script>
document.addEventListener("input", function(a) {
    a = a.target;
    var b;
    "TEXTAREA" == a.tagName && (b = a.parentNode.querySelector("input")) && (b.value = a.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>
<fieldset><label for="note">Примечание
<br><span class="ta_count">знаков <input type="text" name="fieldnote" disabled></span></label>
<textarea id="text" name="note" placeholder="" required></textarea>
</fieldset>

<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>
<fieldset><label for="note">Примечание
<br><span class="ta_count">знаков <input type="text" name="fieldnote" disabled></span></label>
<textarea id="text" name="note" placeholder="" required></textarea>
</fieldset>

<input type="submit" value="Добавить запись"> <input type="reset" value="Сброс">
</form>

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