Complete code:
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]
Script description:
Step 1: Add the following code to the <Script language = "JavaScript">
<! -- Begin
Function changeCase (frmObj ){
Var index;
Var tmpStr;
Var tmpChar;
Var preString;
Var postString;
Var strlen;
TmpStr = frmObj. value. toLowerCase ();
StrLen = tmpStr. length;
If (strLen> 0 ){
For (index = 0; index <strLen; index ++ ){
If (index = 0 ){
TmpChar = tmpStr. substring (0, 1). toUpperCase ();
PostString = tmpStr. substring (1, strLen );
TmpStr = tmpChar + postString;
}
Else {
TmpChar = tmpStr. substring (index, index + 1 );
If (tmpChar = "" & index <(strLen-1 )){
TmpChar = tmpStr. substring (index + 1, index + 2). toUpperCase ();
PreString = tmpStr. substring (0, index + 1 );
PostString = tmpStr. substring (index + 2, strLen );
TmpStr = preString + tmpChar + postString;
}
}
}
}
FrmObj. value = tmpStr;
}
// End -->
</Script>
Step 2: Add the following code to the <body> Area
<Form name = form>
<Input type = text name = box value = "type in here! ">
<Input type = button value = "Convert" onClick = "javascript: changeCase (this. form. box)">
</Form>