Home
Web Front-end
JS Tutorial
js implementation script with all capital letters in English_javascript skills



js implementation script with all capital letters in English_javascript skills
May 16, 2016 pm 07:00 PM
capital
English
Initials
Complete code:
[Ctrl A Select all Note: If you need to introduce external Js, you need to refresh to execute
Script description:
Step 1: Add the following code to the <head> area
<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 <body>In the 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>
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
How Long Does It Take To Beat Split Fiction?
3 weeks ago
By DDD
R.E.P.O. Save File Location: Where Is It & How to Protect It?
3 weeks ago
By DDD

Hot tools Tags

Hot Article
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
How Long Does It Take To Beat Split Fiction?
3 weeks ago
By DDD
R.E.P.O. Save File Location: Where Is It & How to Protect It?
3 weeks ago
By DDD

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

How to solve the problem of English appearing when booting up Windows 10 computer

How to change Google Chrome to Chinese mode?

How to hide the English keyboard in Win11

How to fix the input method that comes with Windows 10 to English

How to get the first letter of Chinese characters in PHP?

In Java, capitalize the last letter of a word and lowercase the first letter

How to solve the problem of English display of Win10 computer icons

How to set the language of Windows 10 Home Edition to English
