101
10-13-2002, 03:56 PM
Can any one help me make a text box and at the side it has a number. The should number increses everytime you add another character to the text box (So it will show the number of charcters in that box)
I have made some code but you have to click for the number of characters in the text box.
<html>
<head>
<title>
</title>
</head>
<body>
<script language="JavaScript">
function CheckSize(form, field) {
if (field ==1) {
Ctrl = form.test;
y = 30;
x = Ctrl.value.length;
}
if (x < y)
SendMsg (Ctrl, "Number of characters is: " + x); else
SendMsg (Ctrl, "Too Long. Number of characters is: " + x);}
function SendMsg (Ctrl, PromptStr) { document.write (PromptStr);
Ctrl.focus(); return;}
</script>
<span id=layer1>0</span>
<form>
<table border="1" cellspacing="1" width="500" cellpadding="4">
<tr>
<td width="100%"><textarea wrap="virtual" rows="3" name="test" cols="26"></textarea>
<input onclick="CheckSize(this.form,1)" type="button" value="Count"></td>
</tr>
</table>
</form>
</body>
</html>
I have made some code but you have to click for the number of characters in the text box.
<html>
<head>
<title>
</title>
</head>
<body>
<script language="JavaScript">
function CheckSize(form, field) {
if (field ==1) {
Ctrl = form.test;
y = 30;
x = Ctrl.value.length;
}
if (x < y)
SendMsg (Ctrl, "Number of characters is: " + x); else
SendMsg (Ctrl, "Too Long. Number of characters is: " + x);}
function SendMsg (Ctrl, PromptStr) { document.write (PromptStr);
Ctrl.focus(); return;}
</script>
<span id=layer1>0</span>
<form>
<table border="1" cellspacing="1" width="500" cellpadding="4">
<tr>
<td width="100%"><textarea wrap="virtual" rows="3" name="test" cols="26"></textarea>
<input onclick="CheckSize(this.form,1)" type="button" value="Count"></td>
</tr>
</table>
</form>
</body>
</html>