Javascript : word capitalization

Does javascript have a function to take a string and capitalize the first letter of every word ?

I'd like to take a string in any format (all caps, all lowercase, etc.) and reformat to capitalize the first letter of every word.

Examples ?
LVL 5
GitchoAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

sajuksCommented:
//credit to fritz the blank
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
<SCRIPT LANGUAGE=javascript>
<!--
function properName(strField)
{
//This function adds capitals to each word in a string if the original text is
//all upper case or all lower case
    var bolMixedCase, strValue, strTempValue, arrName, strProperName
    bolMixedCase = true;
    strValue = document.forms[0].elements[strField].value;
    strTempValue = strValue.toUpperCase()
    if(strValue==strTempValue){
         bolMixedCase = false;
    }
    strTempValue = strValue.toLowerCase()
    if(strValue==strTempValue){
         bolMixedCase = false;
    }
    if(! bolMixedCase){
         arrName= new Array(strValue.length)
         for(intAt=0;intAt<strValue.length;intAt++){
              arrName[intAt] = strValue.substring(intAt,intAt + 1);
         }
         arrName[0] = arrName[0].toUpperCase()
         strProperName = arrName[0]
         for(i=1;i<arrName.length;i++){
              strTest = arrName[i-1];
              if(arrName[i-1].toUpperCase()<"A" || arrName[i-1].toUpperCase()>"Z"){
                   arrName[i] = arrName[i].toUpperCase();
              }else{
                   arrName[i] = arrName[i].toLowerCase();
              }
              strProperName = strProperName + arrName[i];
         }
         eval('document.forms[0].' + strField + '.value=strProperName');
    }
}
//-->
</SCRIPT>

</HEAD>
<BODY>

<FORM action="" method=POST id=form1 name=form1>
Full Name<INPUT type="text" id=text1 name=strName onBlur="properName('strName')">
</FORM>
</BODY>
</HTML>


also check  http://www.experts-exchange.com/Web/Web_Languages/JavaScript/Q_20892916.html
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
GitchoAuthor Commented:
Right on the money ... thanks ...
0
sajuksCommented:
Thanks for the points and grade
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.