You could always lowercase the whole string by changing the first line to :

val = obj.value.toLowerCase();

-----Original Message-----
From: John McKown [mailto:[EMAIL PROTECTED]]
Sent: 26 October 2000 14:08
To: CF-Talk
Subject: RE: Capitalize First Letter of Each Word



This JavaScript DOES work, in the sense that it capitalizes the
first letter of each word, but it does not prevent kids from
entering stuff like this: "UnBeLiEvAbLe".

John McKown, VP Business Services
Delaware.Net, Inc.
30 Old Rudnick Lane, Suite 200 Dover, DE 19901
email: [EMAIL PROTECTED]
phone: 302-736-5515
fax: 302-736-5945
icq: 1495432



> -----Original Message-----
> From: James Lawrence [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, October 26, 2000 8:54 AM
> To: CF-Talk
> Subject: RE: Capitalize First Letter of Each Word
>
>
> John,
>
> Here's a javascript version ( haven't tested it properly, but it should be
> ok )
>
> <SCRIPT LANGUAGE="JAVASCRIPT">
> <!--
>
> function capitalizeMe(obj) {
>       val = obj.value;
>       newVal = '';
>       val = val.split(' ');
>       for(var c=0; c < val.length; c++) {
>               newVal += val[c].substring(0,1).toUpperCase() +
> val[c].substring(1,val[c].length) + ' ';
>       }
>       obj.value = newVal;
> }
>
> // -->
> </SCRIPT>
>
> <FORM NAME="TEST">
>       <INPUT TYPE="TEXT" NAME="TESTER" onChange="capitalizeMe(this)">
> </FORM>
>
>
> James Lawrence, [EMAIL PROTECTED]
> Web Developer, Freeserve.com Plc
> The Observatory, 36-41 Clerkenwell Close, Finsbury, London. EC1R OAU
> Telephone: 02075534832  Mobile: 07971024911
>
>
> -----Original Message-----
> From: John McKown [mailto:[EMAIL PROTECTED]]
> Sent: 26 October 2000 13:35
> To: CF-Talk
> Subject: Capitalize First Letter of Each Word
>
>
> Can someone share a script that will capitalize the
> first letter of every word entered into a form field?
>
> John McKown, VP Business Services
> Delaware.Net, Inc.
> 30 Old Rudnick Lane, Suite 200 Dover, DE 19901
> email: [EMAIL PROTECTED]
> phone: 302-736-5515
> fax: 302-736-5945
> icq: 1495432
>
>
>
> ------------------------------------------------------------------
> ----------
> --------------------
> Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
> Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
> or send a
> message with 'unsubscribe' in the body to
> [EMAIL PROTECTED]
>
> ------------------------------------------------------------------
> ------------------------------
> Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
> Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
> or send a message with 'unsubscribe' in the body to
> [EMAIL PROTECTED]

----------------------------------------------------------------------------
--------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a
message with 'unsubscribe' in the body to [EMAIL PROTECTED]

------------------------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message 
with 'unsubscribe' in the body to [EMAIL PROTECTED]

Reply via email to