[thelist] Javascript Help
Feingold Josh S
Josh.S.Feingold at irs.gov
Wed Apr 10 08:08:01 CDT 2002
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
--
[ Picked text/plain from multipart/alternative ]
I have a page with ten textboxes. I am trying to create a function to limit
the number of characters in each box.
Here is what I have so far...
<script language=Javascript>
function maxlength(name,size) {
number = eval("document.br." + name + ".value.length")
string = eval("document.br." + name + ".value")
if (number > size) {
alert("You have reached the maximum number of characters allowed
for this box.")
newstring = string.substring(0,size)
"document.br." + name + ".value" = newstring // <file://
WRONG> WRONG CODE!!!
}
}
</script>
where name is the name of the textbox and size is the maximum size.
The problem that I have is that I can't reassign the newstring value back to
the original field (e.g. the denoted code is incorrect) . Can anyone offer
any assistance?
Thanks,
Josh
More information about the thelist
mailing list