js monitors mouse events to control the number of input strings in textarea_javascript skills
Release: 2016-05-16 16:34:51
Original
1262 people have browsed it
【Html code】
<table>
<tr>
<td width="150">短信内容:</td>
<td>
<textarea name="message" cols="96" rows="5" onKeyDown="textCounter(message,remLen,65);"
onKeyUp="textCounter(message,remLen,65);"></textarea>
<td>
</tr>
<tr><td></td>
<td>您还可以输入:<input name="remLen" type="text" value="65" size="5" readonly="readonly">个字符,每条短信最大允许输入<strong>65</strong>个字符</td>
</tr>
</table>
Copy after login
[Corresponding js code]
<script>
function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit)
field.value = field.value.substring(0, maxlimit);
else
countfield.value = maxlimit - field.value.length;
}
</script>
Copy after login
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
-
2024-10-22 09:46:29
-
2024-10-13 13:53:41
-
2024-10-12 12:15:51
-
2024-10-11 22:47:31
-
2024-10-11 19:36:51
-
2024-10-11 15:50:41
-
2024-10-11 15:07:41
-
2024-10-11 14:21:21
-
2024-10-11 12:59:11
-
2024-10-11 12:17:31