Please learn JavaScript!! All of you! Get Danny Goodman's JavaScript Bible
and put it on the shelf on your desk after reading it cover to cover. Do
yourselves a favour. Nearly all scripting languages (including CFSCRIPT and
Action script) are based closely on JavaScript... JSB is a dictionary for
JavaScript - ie you can look up what you want quickly and easily.

I got so frustrated watching you try to use styles in Internet Explorer that
I felt sorry for you and wrote these two scripts. If you haven't worked out
by now that IE is NOT standards compliant, then you need to wake up and
smell the coffee!! IE5+ is the new NS4, that is the bain of everyone's
existence; an over-patched piece of poo!

<gets off soapbox>

Here's the old fashioned way... ( ie: without using Regex ) I've made it
easy to read so that you can learn a little more about Javascript. 

The first function sets the first letter ONLY and the second function sets
the first letter of each word.

<SCRIPT LANGUAGE="JavaScript">

        function firstLetterCaps(string) {
                partOne = string.substring(0,1);
                partTwo = string.substring(1,string.length);
                return partOne.toUpperCase() + partTwo.toLowerCase();
                }       

        function firstCaps (string) {
                lastSpace = -2;
                outputString = "";
                for ( a=0; a<string.length; a++) {
                        thisLetter = string.substring(a,a+1);
                        if ( thisLetter == " " ) {
                                lastSpace = a;
                                }
                        alert(a + " : " + thisLetter );
                        if ( a==0 || a == lastSpace+1 ) {
                                outputString += thisLetter.toUpperCase();
                                }
                        else {
                                outputString += thisLetter.toLowerCase();
                                }
                        } 
                return outputString     ;
                }

</SCRIPT>

<INPUT TYPE="text" NAME="thisField" VALUE="sweet" onBlur="this.value =
firstCaps(this.value);">

-----Original Message-----
From: Robertson-Ravo, Neil (RX)
[mailto:[EMAIL PROTECTED] 
Sent: Tuesday, 17 August 2004 11:26 PM
To: '[EMAIL PROTECTED]'
Subject: RE: [ cf-dev ] OT: JS Bold first letter

Yeah the caps works but it looks like its impossible to embolden the first
letter in an input field...



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 
Sent: 17 August 2004 12:09
To: [EMAIL PROTECTED]
Subject: RE: [ cf-dev ] OT: JS Bold first letter


the first one definitely works fine for me.  never used the other one
before, so don't know why it doesn't work.




 

                    "Robertson-Ravo, Neil (RX)"

                    <[EMAIL PROTECTED]        To:
"'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>     
                    dexpo.com>                          cc:

                                                        Subject:     RE: [
cf-dev ] OT: JS Bold first letter                      
                    17/08/2004 12:06

                    Please respond to dev

 

 




Neither seem to work....?



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
Sent: 17 August 2004 12:00
To: [EMAIL PROTECTED]
Subject: RE: [ cf-dev ] OT: JS Bold first letter


this will capitalise the first letter of each word:
<input type="text" style="text-transform:capitalize">

I expect you could also use Mark's suggestion:
<input type="text" style="first-letter {font-weight: bold;}">






                    "Robertson-Ravo, Neil (RX)"

                    <[EMAIL PROTECTED]        To:
"'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
                    dexpo.com>                          cc:

                                                        Subject:     RE: [
cf-dev ] OT: JS Bold first letter
                    17/08/2004 11:58

                    Please respond to dev








Erm, don't think so, it's in a form field (more than one on the page)

-----Original Message-----
From: Mark Smyth [mailto:[EMAIL PROTECTED]
Sent: 17 August 2004 11:52
To: '[EMAIL PROTECTED]'
Subject: RE: [ cf-dev ] OT: JS Bold first letter

Can you use css?
E.g.
<style>
p:first-letter {font-weight: bold;}
</style>
</head>

<body>
<p>
This is a test
</p>

-----Original Message-----
From: Robertson-Ravo, Neil (RX)
[mailto:[EMAIL PROTECTED]
Sent: 17 August 2004 11:47
To: '[EMAIL PROTECTED]'
Subject: [ cf-dev ] OT: JS Bold first letter


Got a bit of a brain fuzz, anyone got any JS which will embolden the first
letter of a string being typed into a text field?

N


This e-mail is from Reed Exhibitions (Oriel House, 26 The Quadrant,
Richmond, Surrey, TW9 1DL, United Kingdom), a division of Reed Business,
Registered in England, Number 678540.  It contains information which is
confidential and may also be privileged.  It is for the exclusive use of
the
intended recipient(s).  If you are not the intended recipient(s) please
note
that any form of distribution, copying or use of this communication or the
information in it is strictly prohibited and may be unlawful.  If you have
received this communication in error please return it to the sender or call
our switchboard on +44 (0) 20 89107910.  The opinions expressed within this
communication are not necessarily those expressed by Reed Exhibitions.
Visit
our website at http://www.reedexpo.com

--
These lists are syncronised with the CFDeveloper forum at
http://forum.cfdeveloper.co.uk/
Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided
by activepdf.com*
      *Forums provided by fusetalk.com* :: *ProWorkFlow provided by
proworkflow.com*
           *Tutorials provided by helmguru.com* :: *Lists hosted by
gradwell.com*

To unsubscribe, e-mail: [EMAIL PROTECTED]



--
These lists are syncronised with the CFDeveloper forum at
http://forum.cfdeveloper.co.uk/
Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided
by activepdf.com*
      *Forums provided by fusetalk.com* :: *ProWorkFlow provided by
proworkflow.com*
           *Tutorials provided by helmguru.com* :: *Lists hosted by
gradwell.com*

To unsubscribe, e-mail: [EMAIL PROTECTED]
This e-mail is from Reed Exhibitions (Oriel House, 26 The Quadrant,
Richmond, Surrey, TW9 1DL, United Kingdom), a division of Reed Business,
Registered in England, Number 678540.  It contains information which is
confidential and may also be privileged.  It is for the exclusive use of
the
intended recipient(s).  If you are not the intended recipient(s) please
note
that any form of distribution, copying or use of this communication or the
information in it is strictly prohibited and may be unlawful.  If you have
received this communication in error please return it to the sender or call
our switchboard on +44 (0) 20 89107910.  The opinions expressed within this
communication are not necessarily those expressed by Reed Exhibitions.
Visit our website at http://www.reedexpo.com

--
These lists are syncronised with the CFDeveloper forum at
http://forum.cfdeveloper.co.uk/
Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided
by activepdf.com*
      *Forums provided by fusetalk.com* :: *ProWorkFlow provided by
proworkflow.com*
           *Tutorials provided by helmguru.com* :: *Lists hosted by
gradwell.com*

To unsubscribe, e-mail: [EMAIL PROTECTED]






--
These lists are syncronised with the CFDeveloper forum at
http://forum.cfdeveloper.co.uk/
Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided
by activepdf.com*
      *Forums provided by fusetalk.com* :: *ProWorkFlow provided by
proworkflow.com*
           *Tutorials provided by helmguru.com* :: *Lists hosted by
gradwell.com*

To unsubscribe, e-mail: [EMAIL PROTECTED]
This e-mail is from Reed Exhibitions (Oriel House, 26 The Quadrant,
Richmond, Surrey, TW9 1DL, United Kingdom), a division of Reed Business,
Registered in England, Number 678540.  It contains information which is
confidential and may also be privileged.  It is for the exclusive use of
the
intended recipient(s).  If you are not the intended recipient(s) please
note
that any form of distribution, copying or use of this communication or the
information in it is strictly prohibited and may be unlawful.  If you have
received this communication in error please return it to the sender or call
our switchboard on +44 (0) 20 89107910.  The opinions expressed within this
communication are not necessarily those expressed by Reed Exhibitions.
Visit our website at http://www.reedexpo.com

--
These lists are syncronised with the CFDeveloper forum at
http://forum.cfdeveloper.co.uk/
Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided
by activepdf.com*
      *Forums provided by fusetalk.com* :: *ProWorkFlow provided by
proworkflow.com*
           *Tutorials provided by helmguru.com* :: *Lists hosted by
gradwell.com*

To unsubscribe, e-mail: [EMAIL PROTECTED]






-- 
These lists are syncronised with the CFDeveloper forum at
http://forum.cfdeveloper.co.uk/
Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
 
CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided
by activepdf.com*
      *Forums provided by fusetalk.com* :: *ProWorkFlow provided by
proworkflow.com*
           *Tutorials provided by helmguru.com* :: *Lists hosted by
gradwell.com*

To unsubscribe, e-mail: [EMAIL PROTECTED]
This e-mail is from Reed Exhibitions (Oriel House, 26 The Quadrant,
Richmond, Surrey, TW9 1DL, United Kingdom), a division of Reed Business,
Registered in England, Number 678540.  It contains information which is
confidential and may also be privileged.  It is for the exclusive use of the
intended recipient(s).  If you are not the intended recipient(s) please note
that any form of distribution, copying or use of this communication or the
information in it is strictly prohibited and may be unlawful.  If you have
received this communication in error please return it to the sender or call
our switchboard on +44 (0) 20 89107910.  The opinions expressed within this
communication are not necessarily those expressed by Reed Exhibitions.
Visit our website at http://www.reedexpo.com

-- 
These lists are syncronised with the CFDeveloper forum at
http://forum.cfdeveloper.co.uk/
Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
 
CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided
by activepdf.com*
      *Forums provided by fusetalk.com* :: *ProWorkFlow provided by
proworkflow.com*
           *Tutorials provided by helmguru.com* :: *Lists hosted by
gradwell.com*

To unsubscribe, e-mail: [EMAIL PROTECTED]



-- 
These lists are syncronised with the CFDeveloper forum at 
http://forum.cfdeveloper.co.uk/
Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
 
CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided by 
activepdf.com*
      *Forums provided by fusetalk.com* :: *ProWorkFlow provided by proworkflow.com*
           *Tutorials provided by helmguru.com* :: *Lists hosted by gradwell.com*

To unsubscribe, e-mail: [EMAIL PROTECTED]

Reply via email to