Hi, i am trying to set this up so that if user enters his or her name with bunch of upper and lower cases there would be a message of some sort asking if the user wants to leave the name the way he wrote it if user clicks yes then name stays as it is if he clicks no then it will be changed to the proper casing which is coded in here:
[CODE]<!–Content–>
<form name=theForm id=theForm>
<input name=text1 id=text1 value=”” onchange=”this.value = PCase2(this.value);”>
<br>
<br>
<a href=”#” class=PageMenu style=”width:250;” onclick=”document.theForm.text1.value = PCase(document.theForm.text1.value);”><strong>Convert to Proper Case</strong></a>
<h3>
</textarea>
</form>
<!–End Content–>
<script>
function PCase(STRING)
{
var strReturn_Value = “”;
var iTemp = STRING.length;
if(iTemp==0){
return””;
}
var UcaseNext = false;
var test = STRING.indexOf(‘de ‘);
if(test != -1){
strReturn_Value += STRING.charAt(0).toLowerCase();
}else{
strReturn_Value += STRING.charAt(0).toUpperCase();
}
for(var iCounter=1;iCounter < iTemp;iCounter++){
if(UcaseNext == true){
strReturn_Value += STRING.charAt(iCounter).toUpperCase();
}
else{
strReturn_Value += STRING.charAt(iCounter).toLowerCase();
}
var iChar = STRING.charCodeAt(iCounter);
if(iChar == 32 || iChar == 45 || iChar == 46){
UcaseNext = true;
}
else{
UcaseNext = false
}
if(iChar == 99 || iChar == 67){
if(STRING.charCodeAt(iCounter-1)==77 || STRING.charCodeAt(iCounter-1)==109){
UcaseNext = true;
}
}
if(iChar == 39){
if(STRING.charCodeAt(iCounter-1)==79 || STRING.charCodeAt(iCounter-1)==111){
UcaseNext = true;
}
}
} //End For
return strReturn_Value;
} //End Function
</script>
please help me up setting up that message
what i was thinking about was saying something like :
[CODE]
function PCase2(STRING)
{
var strReturn_Value = “”;
var iTemp = STRING.length;
if(iTemp==0){
return””;
}
for(var iCounter=1;iCounter < iTemp;iCounter++){
var iChar = STRING.charCodeAt(iCounter);
if(iChar == 65 || iChar == 66 || iChar == 67 || iChar == 68 || iChar == 69 || iChar == 70 || iChar == 71 || iChar == 72 || iChar == 72 || iChar == 73 || iChar == 74 || iChar == 75 || iChar == 76 || iChar == 77 || iChar == 78 || iChar == 79 || iChar == 80 || iChar == 81 || iChar == 82 || iChar == 83 || iChar == 85 || iChar == 86 || iChar == 87 || iChar == 88 || iChar == 89 || iChar == 90){
alert(“Your name has upper and lower case lettering n Do you want to leave it like that n or else it will be changed to the proper format”);
return false;
}else{
Pcase(STRING);
}
}
return strReturn_Value;
}
but alert is not what i need and it surely is not the proper way to code it…
please Help
Alina