HighDots Forums  

Re: Text Box (Javascript to limit content)

Macromedia Dreamweaver Macromedia Dreamweaver Discussions (macromedia.dreamweaver)


Discuss Re: Text Box (Javascript to limit content) in the Macromedia Dreamweaver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Andi Fenner
 
Posts: n/a

Default Re: Text Box (Javascript to limit content) - 07-08-2003 , 05:44 AM






Hi

Thanks very much for replying to my problem. I don't know if I'm being a
bit thick but I've copied the code and tried to test it but it doesn't work.
I've copied the code used below. Am I missing something basic?

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin
Function textCounter(field, countfield, maxlimit) {
If (field.value.length > maxlimit) // If too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
Else
countfield.value = maxlimit - field.value.length;
}
// End -->
</script>

<!-- textCounter() parameters are: Text field, the count field, max
length -->

<center>
<form name=myform action="http://www.netevolution.co.uk">
<font size="1" face="arial, helvetica, sans-serif"> ( You may enter up To
125 characters. )<br>
<textarea name=message wrap=physical cols=28 rows=4
onKeyDown="textCounter(this.form.message,this.form .remLen,125);"
onKeyUp="textCounter(this.form.message,this.form.r emLen,125);"></textarea>
<br>
<Input readonly Type=Text name=remLen size=3 maxlength=3 value="125">
characters Left</font>
</form>
</center>





"Martha Graham" <martha (AT) dmxzone (DOT) com> wrote

Quote:
Hi Andi,

I found this script:
http://www.ex-designz.net/codemanager2/script_description.asp?ScriptID=340

Hope it helps you.

Martha Graham
www.DMXzone.com
"Andi Fenner" <andi.fenner (AT) domnickhunter (DOT) com> schreef in bericht
news:bee26l$mte$1 (AT) forums (DOT) macromedia.com...
Does anyone know the Javascript to limit the amount of characters a user
can
type into a text box.

Any help would be appreciated.

Ta, Andi







Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.