deadlock Message Board
[ February Full List | Post A Reply ]

Re: Title Case Function
From Michael Hatch on 14 Feb '02
replying to Re: Title Case Function posted by Michael Hatch

In case anyone has been following this thread, here is the
completed code.

This is a copyrighted work and the intellectual property of the
author. Any reposting or reproduction is strictly prohibited
without the express written permission of the author. (C)2002
Michael Hatch mrhatch@juno.com

<HTML>
<HEAD>
<SCRIPT>
function titleCase()
{
var result = "";
var wordArray = this.word.split(" ");
for (var i = 0; i < wordArray.length; i++)
{
var wordLength = wordArray[i].length;
result += wordArray[i].charAt(0).toUpperCase() +
wordArray[i].substring(1,wordLength).toLowerCase() + " ";

}
this.word = result;
}
function titlestr(word)
{
this.word = word;
this.titleCase = titleCase;
}
function testwrite()
{
var testword = new titlestr("test stuff");
var testword2 = new titlestr("single");
var testword3 = new titlestr("now is the time for all good
men to COME to the aid of their party");

testword.titleCase();
testword2.titleCase();
testword3.titleCase();
document.writeln(testword.word + "<BR>
");
document.writeln(testword2.word + "<BR>");
document.writeln(testword3.word + "<BR>");
}

</SCRIPT>
</HEAD>
<BODY BGCOLOR=#FFFFCC>
<SCRIPT>testwrite();</script>
</BODY>
</HTML>




Your Reply

*Your name:
*Message subject:
Home page title:
Home page URL:
Email:
(if you'd like to receive automatic replies by email)