C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Articles » General »

Javascript: Proper Case conversion ...


Posted Date: 18 Feb 2007    Resource Type: Articles    Category: General
Author: Vadivel MohanakrishnanMember Level: Diamond    
Rating: 1 out of 5Points: 10



Introduction


There are times when you want to convert strings entered by users into "Proper Case". This javascript helps you with that task.

Source Code



<html>
<head>
<title>Proper Case Validation -- Sample by Vadivel</title>
<script>
<!--

function ConvertToProperCase()
{
strTemp = document.form1.txtString.value
strTemp = strTemp.toLowerCase()

var test=""
var isFirstCharOfWord = 1

for (var intCount = 0; intCount < strTemp.length; intCount++)
{

var temp = strTemp.charAt(intCount)
if (isFirstCharOfWord == 1)
{
temp = temp.toUpperCase()
}

test = test + temp
if (temp == " ")
{
isFirstCharOfWord = 1
}
else isFirstCharOfWord = 0
}
document.form1.txtString.value = test
}
// -->
</script>
</head>

<body>

<form name=form1>
<input size=50 name=txtString>
<input type=button onClick=ConvertToProperCase() value="Convert It Now">
</form>

</body>
</html>




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
Javascript  .  Case conversion  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Approach to DATE field in a Different Way [ASP & JavaScript]
Previous Resource: A Review on TaskManager Extension Tool from CodeProject
Return to Discussion Resource Index
Post New Resource
Category: General


Post resources and earn money!
 
Related Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use