Our Flash tutorials provide you with step-by-step instructions on how to create beautiful Flash animations and integrate them into your website.  Home Flash & Swish Flash Tutorials Uppercase First Letter
Your Ad Here

Uppercase First Letter


Personally i feel that making the first letter of a word, in a sentence and sometimes the first letter of every word in a sentence, looks better than all lowercase. When it comes to input textfields and the loading of external content, i like to make the first letter capitalised, so i created a String method, which i use regularly and i thought i would share it...

Heres the code for the method:

String.prototype.ucFirst=function()
{
if(arguments[0] == true)
{
var words=this.split(" ")
for(var w in words)
{
words[w]=words[w].ucFirst()
}
return words.join(" ")
}
return this.charAt(0).toUpperCase()+this.substring(1,this.length)
}

And heres how you would use it:

input_title="this is my title";
title=input_title.ucFirst();
input_name="guy watson";
name=input_name.ucFirst(true);

image 1



Author's URL: Guy Watson
Thank you for voting.
Rate this Materials:
Bad 
1 2 3 4 5 Excellent
Share print this page subscribe to newsletter subscribe to rss

Our Flash tutorials provide you with step-by-step instructions on how to create beautiful Flash animations and integrate them into your website. More Flash & Swish: Most Popular Materials | Fresh Materials | More Flash Tutorials at FlashPerfection.com

No comments yet...
Add comments to "Uppercase First Letter"

Captcha