I'm totally not a Javascript person...so, maybe one of you can help me out. I'd appreciate it!
I've got this strange request that requires some validation. I will have on a web page an input box and another input box next to it. The user will type text in the first one, the second will count the number of characters. There will be up to 10 lines (so, 20 boxes total - 10 inputs and 10 inputs that display counts).
So, how can I accomplish this? I have:
<script language="javascript">
function countChars2(field1,field2) {
var myCount = eval('document.frmTest.' + field1 + '.value.length');
// How do I make text2 display myCount?
//I tried:
//document.frmTest.field2.value = myCount;
//but that did not work
return true;
}
</script>
<form name="frmTest" id="frmTest" action="test.asp" method="post">
<input type="text" size="55" maxLength="50" name="text1" id="text1" onKeyUp="countChars2('text1','text2')">
<input type="text" size="10" disabled name="text2" id="text2" value="0">
</form>
Any help will be greatly appreciated!
Thanks,
Andrew
I've got this strange request that requires some validation. I will have on a web page an input box and another input box next to it. The user will type text in the first one, the second will count the number of characters. There will be up to 10 lines (so, 20 boxes total - 10 inputs and 10 inputs that display counts).
So, how can I accomplish this? I have:
<script language="javascript">
function countChars2(field1,field2) {
var myCount = eval('document.frmTest.' + field1 + '.value.length');
// How do I make text2 display myCount?
//I tried:
//document.frmTest.field2.value = myCount;
//but that did not work
return true;
}
</script>
<form name="frmTest" id="frmTest" action="test.asp" method="post">
<input type="text" size="55" maxLength="50" name="text1" id="text1" onKeyUp="countChars2('text1','text2')">
<input type="text" size="10" disabled name="text2" id="text2" value="0">
</form>
Any help will be greatly appreciated!
Thanks,
Andrew